Android Studio:执行任务失败:app:编译Debug AIDL失败。

18

我安装了Android Studio 1.2.1.1,Gradle版本为2.2.1,Android插件版本为1.2.3。我尝试创建一个简单的Hello World项目,但是却出现了构建失败:app:compileDebugAidl FAILED。我是否缺少什么或者版本不兼容,因为这应该是一个简单的应用程序。感谢任何帮助。

这是我收到的编译错误:

Information:Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72220Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42220Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl FAILED
Error:Execution failed for task ':app:compileDebugAidl'.
> aidl is missing
Information:BUILD FAILED

你应该先尝试重新启动。 - Ya Wang
不,肯定是其他问题了。我已经重新启动了计算机,但问题依旧。 - Tedha
如果您清理项目并且没有错误,我认为您应该检查Gradle配置构建: https://developer.android.com/tools/building/configuring-gradle.html - Belal mazlom
7个回答

51

我遇到了相同的问题。

右键单击应用程序->打开模块设置。在此菜单中将“构建工具版本”设置为22.0.1版本。

设置完成后,我成功地构建了项目。


感谢您的修复。为了澄清,这是一个随 Android Studio 发布的错误吗?还是可能是我的设置出了问题? - jasonsemko
5
由于它的缺陷,Android Studio真的很烦人。 - Syed Raza Mehdi
我认为这是因为您在Android SDK管理器中意外安装了Android SDK Build-tools 23 rc2。因此,这不是一个特定于Android Studio的问题。 - Stef

4
我遇到了同样的问题,并通过更改首选项 -> 构建、执行、部署 -> 构建工具 -> Gradle -> 项目级设置,从 'Use local gradle distribution' 更改为 'Use default gradle wrapper (recommended)' 来解决它。
希望能有所帮助。

请注意:从版本1.2.1.1开始,您可以在“文件”>“设置”>“构建、执行、部署”>“构建工具”>“Gradle”下找到此设置。 - angryITguy

3

请前往 文件->设置->构建->Gradle,选择使用默认的gradle wrapper(推荐)


我忘了提到我不得不删除SDK 23.X rc,因为它引起了问题。 - ASP

1
有时错误的源头并不是很清楚。我曾试图重构一个包,但我的某个类仍使用旧的包名称,导致编译失败。我通过在路径中搜索Gradle控制台中生成的错误来找到了错误。我在项目中手动更改了旧的包名称。然后我的APK编译成功了。

1
我通过更新Android SDK构建工具解决了这个问题。

SDK管理器 > 工具 > Android SDK构建工具 > 安装> 重启


1

版本兼容性 1.0版本及其后的Android Studio和Gradle插件需要保持兼容性,这是至关重要的要求。 虽然我们仍在制定最终的政策,但您至少应该期望:

Studio 1.x与Gradle插件1.y相兼容。

Newer versions of the Gradle plugin may require newer versions of Studio to enable the new features in the IDE, but the project should open in older versions of Studio, and build from there (since Gradle does the build). We will be very careful about this.
 We will determine later our compatibility story between Studio 2.x and Gradle Plugin 1.x and between Studio 1.x and Gradle Plugin 2.x
We will make every effort to keep compatibility where possible, and to provide good Quick Assist to help with migration where applicable.

Gradle插件1.0.0 - 1.1.3适用于Gradle 2.2.1 - 2.3。

It does not work with Gradle 2.4+

Gradle插件1.2+适用于Gradle [2.2.1,3.0[版本。保留HTML,不做解释。
Newer versions of the Plugin may require a newer version of Gradle to benefit from advanced features.

However the current 1.2+ should work with [2.2.1, 3.0[
(We cannot guaranteed compatibility with 3.x as it may introduce breaking changes: Gradle 1.x -> 2.0 introduced Groovy breaking changes)


Android Studio      Android Gradle Plugin      Gradle

1.0.0+               1.0.0 - 1.1.3           2.2.1 - 2.3
1.0.0+               1.2+                    2.2.1+

1.0版本之前的DSL发生了很多变化,但现在应该是稳定的。

如果/当我们需要进行更改时,我们将有很长的弃用期,可能长达6个月甚至12个月。预览兼容性 此表指示了与1.0版本之前组件的兼容性。

所有这些破坏性更改都是因为我们对IDE和Gradle之间交换的模型进行了大量微调。所有这些工作都是为了确保在1.0版本之后的稳定性。

有关更多信息,请转到http://tools.android.com/tech-docs/new-build-system/version-compatibility


0

不要运行整个应用程序,而是尝试仅运行包含<intent-filter>的特定活动,然后再尝试运行整个应用程序。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接