Gradle 代码未构建:缺少 aidl [英] Gradle code not building: aidl is missing
问题描述
我将 android studio 从 1.0 版更新到 1.2.1 版,当我启动我的第一个应用程序时,出现了这个.
I updated android studio from version 1.0 to 1.2.1 and when I started my first application the this appears.
错误:任务:app:compileDebugAidl"的执行失败.
Error:Execution failed for task ':app:compileDebugAidl'.
缺少aidl
我已确保所有 sdk 都是最新的.这是我的 gradle 构建代码.
I have made sure that all sdk are up to date. This is my gradle build code.
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'
}
推荐答案
AndroidStudio-1.3-Preview 似乎使用了意外版本的 gradle 插件.(至少当你创建一个全新的项目时)
It seems that AndroidStudio-1.3-Preview is using an unexpected version of the gradle plugin. (at least when you create a fresh new project)
同样,如果您使用以下方法打开现有项目:
Similarly, if you open an existing project using:
- 旧版本的插件.(<1.3.0-beta1)
- 最新的构建工具 (23.0.0-rc1)
- 编译SDK 22
---> 你可能会遇到这个奇怪的错误:aidl is missing"(即使在不使用 aidl 的项目中!)
---> you will probably have this strange error : "aidl is missing" (even in projects not using aidl !)
解决方案:
请务必使用最新的 android-gradle-plugin(在根 build.gradle 中):
Be sure to use the latest android-gradle-plugin (in the root build.gradle) :
classpath 'com.android.tools.build:gradle:1.3.0-beta1'
在buildscript-->依赖项下.
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 模块中):
and the latest build tools (in module build.gradle):
android {
compileSdkVersion 22
buildToolsVersion "23.0.0 rc1"
... }
请注意,通过此配置,您使用的是最新的构建工具 - 尚未发布 - 以及 Android-M 的预览版 ---> 事情可能不稳定
这篇关于Gradle 代码未构建:缺少 aidl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!