2015-05-30 49 views
4

我更新了android studio从版本1.0到1.2.1,当我开始我的第一个应用程序时,出现这个。Gradle code not building:aidl is missing

错误:执行任务':app:compileDebugAidl'失败。

aidl is missing

我确定所有的sdk都是最新的。这是我的gradle构建代码。

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 22 
    buildToolsVersion "23.0.0 rc1" 

defaultConfig { 
    applicationId "com.example.william.myapplication" 
    minSdkVersion 17 
    targetSdkVersion 22 
    versionCode 1 
    versionName "1.0" 

    compileSdkVersion 21 

} 
buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
} 

}

dependencies { 
    compile fileTree(dir: 'libs', include: '*.jar') 
    compile 'com.android.support:appcompat-v7:22.2.0' 
} 

回答

9

似乎AndroidStudio-1.3预览使用gradle这个插件的意外版本。 (至少当你创建一个全新的项目)

同样,如果您打开使用现有项目:

  • 旧版本的插件。 (< 1.3.0-β1)
  • 最新版本的工具(23.0.0-RC1)
  • compileSDK 22

--->你将可能有这个奇怪的错误: “AIDL缺少”(甚至在项目未使用AIDL)

!解决方法:

一定要使用最新的Android-gradle这个-插件(在根的build.gradle):

classpath 'com.android.tools.build:gradle:1.3.0-beta1' 

under buildscript - > dependencies。

例子:

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

     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 

和最新版本的工具(模块的build.gradle):

android { 
    compileSdkVersion 22 
    buildToolsVersion "23.0.0 rc1" 
    ... } 

意识到,这个配置你使用的是最新版本的工具 - 而不是发布还有和Android-M的预览--->东西可能不稳定

+0

或者降级到'22.0.1'为'buildToolsVersion',特别是如果你没有建立的M开发者预览版。 – CommonsWare

6

我有同样的错误。我将gradle脚本中的构建工具版本更改为我在sdk管理器中找到的实际sdk构建工具版本,并且完成了这个技巧。

android { 
    compileSdkVersion 22 
    buildToolsVersion "22.0.1" 

...