2016-08-20 55 views
1

这里我有一个问题,我已经在修订24.0.1安装构建工具,这里是从我的终端屏幕快照:已经已经安装了构建工具,但未能找到构建工具版本24.0.1

build tool on my computer

事实上,我觉得我写的很好的的build.gradle文件buildToolsVersion "24.0.1",但在同步的项目仍出现这样的错误:

fail to find build tool revision 24.0.1 install such build tools

另一个问题是关于Android中的文件下订单工作室。以下是导入的项目层次结构,清单文件位于主文件夹下,并且我无法在android视图下找到任何使用情况文件。

import project hierachy

这样的项目层次我从来没有见过,也许有别人谁能够证明这样回答我。谢谢。

更新:这里是的build.gradle文件图片

build.gralde file picture

+0

请出示请问你的'build.gradle'样子。此外,我想这个问题可以分为两个单独的问题 –

+0

好的,我已经更新了上面的build.gradle文件 – Crabime

回答

2

你正在做它在错误的道路。有两种类型的build.gradle文件。第一个是project,第二个是module,可以是多个。在你的情况下,你正在混合两者。

该项目的build.gradle应该是这样的:

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.1.2' 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
    } 
} 

task clean(type: Delete) { 
    delete rootProject.buildDir 
} 

像这样的模块build.gradle看起来应该是:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 24 
    buildToolsVersion "24.0.1" 

    defaultConfig { 
     applicationId "com.something" 
     minSdkVersion 14 
     targetSdkVersion 24 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:24.1.1' 
    compile 'com.android.support:support-v4:24.1.1' 
    compile 'com.android.support:design:24.1.1' 
    compile 'com.android.support:cardview-v7:24.1.1' 
    compile 'com.android.support:recyclerview-v7:24.1.1' 
} 
+0

您的描述是正确的,我认为应该在项目层次结构上出现错误。为什么build.gradle(模块)下的应用程序文件夹,它出现在项目perspective.at同时我不认为build.gradle文件内容是错误的,比较你的文件和我的。没有区别。 – Crabime

+0

打开独立的sdk管理器并检查是否安装了所有必需的东西以确保安全。 –

0

关于你提到的第二个问题,你看到的分层结构称为Project视图。

enter image description here

By default, Android Studio displays your project files in the Android view. This view does not reflect the actual file hierarchy on disk, but is organized by modules and file types to simplify navigation between key source files of your project, hiding certain files or directories that are not commonly used. (...) To see the actual file structure of the project including all files hidden from the Android view, select Project from the dropdown at the top of the Project window.

来源:https://developer.android.com/studio/projects/index.html

相关问题