2015-05-28 126 views
38
Environment: 
Mac OS 10.10.3 
Android studio:1.2.11 
grandle:2.2.1 

日志:AIDL缺少机器人工作室

Information:Gradle tasks [:generateDebugSources, :generateDebugTestSources] 
:preBuild 
:preDebugBuild 
:checkDebugManifest 
:prepareDebugDependencies 
:compileDebugAidl FAILED 
Error:Execution failed for task ':compileDebugAidl'. 
> aidl is missing 

 

// Top-level build file where you can add configuration options common to all sub-projects/modules. 
import org.gradle.internal.os.OperatingSystem 
buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:1.0.0' 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
    } 
} 
String SDK_DIR = System.getenv("ANDROID_HOME") 
if(SDK_DIR == null) { 
    Properties props = new Properties() 
    props.load(new FileInputStream(project.rootProject.file("local.properties"))) 
    SDK_DIR = props.get('sdk.dir'); 
} 


apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 21 
    buildToolsVersion "21.1.1" 

    sourceSets { 
     main { 
      manifest.srcFile 'AndroidManifest.xml' 
      java.srcDirs = ['src'] 
      resources.srcDirs = ['src'] 
      aidl.srcDirs = ['src'] 
      renderscript.srcDirs = ['src'] 
      res.srcDirs = ['res'] 
      assets.srcDirs = ['assets'] 
      jniLibs.srcDirs = ['libs'] 
     } 

     // Move the tests to tests/java, tests/res, etc... 
     instrumentTest.setRoot('tests') 

     // Move the build types to build-types/<type> 
     // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... 
     // This moves them out of them default location under src/<type>/... which would 
     // conflict with src/ being used by the main source set. 
     // Adding new build types or product flavors should be accompanied 
     // by a similar customization. 
     debug.setRoot('build-types/debug') 
     release.setRoot('build-types/release') 
    } 
    defaultConfig { 
     minSdkVersion 14 
     targetSdkVersion 21 
    } 

    buildTypes { 
     release { 
      proguardFiles 'proguard.cfg' 
     } 
    } 

    lintOptions { 
     checkReleaseBuilds false 
     // Or, if you prefer, you can continue to check for errors in release builds, 
     // but continue the build even when errors are found: 
     abortOnError false 
    } 
} 

dependencies { 
    compile fileTree(include: '*.jar', dir: 'libs') 

    provided files("${SDK_DIR}/platforms/android-17/data/layoutlib.jar") 
    //compile files('libs/pass-v1.1.3.jar') 
    // compile files('libs/sdk-v1.0.0.jar') 
} 

在此之前,我已经编译了Android资源4.4在我的Mac,以及OS系统修改了一些文件,我认为这是原因,但我忘了哪个文件,有人遇到过这个问题呢

+0

[Execution failed for task':app:compileDebugAidl':aidl is missing]可能重复(http://stackoverflow.com/questions/29766830/execution-failed-for-task-appcompiledebugaidl-aidl-is-missing ) – mixel

回答

20

I solve my issue, set the build tools version from 21.1.2 to 22.0.1, hope it can help who meet the same.

我解决我的问题,将构建工具版本21.1.2从到22.0.1,希望它可以帮助谁满足相同的。

66

在我的cas e我使用Android Studio 1.2.1.1下载了Android M版本22和Android 5.1.1,但是当我尝试做一个Hello World时,同样的错误告诉我

因此,解决方案是去做像应用程序中的右键点击下面和图像选择“打开模块设置” .....

enter image description here

那么你有两个选择。我用最后一个版本改变了它们。

编译SDK版本API 21棒棒堂

enter image description here

和构建工具版本21.1.2到

enter image description here

最后清理项目和建设

UPDATE 这里是我的build.gradle与您的build.gradle进行比较。

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 21 
    buildToolsVersion '21.1.2' 

    defaultConfig { 
     applicationId "com.android.bmi" 
     minSdkVersion 15 
     targetSdkVersion 22 
     versionCode 1 
     versionName "1.0" 
    } 
    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' 
} 

修订

来获得的Android 1.3工作室遵循通过选择文件时,此步骤

  1. 打开设置窗口>设置。
  2. 选择外观&行为>系统设置>更新面板。
  3. 在“更新”面板上,选择自动检查更新的选项:Canary Chanel。
  4. 在“更新”面板上,选择“立即检查”以检查最新的金丝雀版本。 5.提示时下载并安装该版本。

然后你就会有这样的事情更新Android工作室到1.3,并用这个你可以测试版本的Android M

enter image description here

+1

谢谢豪尔赫。在Windows 8.1上解决了我的问题 –

+1

这解决了我在OSX上的问题10 – TrialAndError

+0

您应该将问题标记为“正确”。 – EduardoFernandes

8

随着距离Jorge的帖子截屏所有你需要做的是确保你不要选择构建工具版本23.0.0 rc1。我还没有在IDE或Google的错误跟踪器中完全调查过这个版本,但是我只需要选择以前的工具版本,并且在执行完整版本之后就可以正常工作。我用各种SDK分钟版本尝试了这一点。

我运行OSX 10.10.3与Android工作室1.2.1.1在Oracle JDK 1.8.0_45-b14的

用解决 这个问题在本质上Execution failed for task ':app:compileDebugAidl': aidl is missing相同的已更新运行。请阅读我的帖子,了解解决方案的合适解决方案和参考资料。

+0

因此,我搜索了Google Android bug跟踪器,并且有人提出了一个我评论过的未解决的问题。 Android项目成员评论说,如果您想使用Build Tools版本23.0.0 rc1,IDE会通知您获取Gradle Plugin 1.3.0-beta1。请参阅:https://code.google.com/p/android/issues/detail?id=175080 –

2

人谁正在建设与Android 1.3的工作室预览应用程序可能会调试AIDL失踪错误 解决方案:(按顺序遵循) 1)下载所有的工具预览通道下(即修订没有23.0.0 RC1) 2)下载播放服务和Android支持回购支持 3)重新启动Android Studio 4)按F4并将编译SDK版本设置为API 22+和Build tool版本23.0.0 rc1 5)打开build.gradle(Project:** ****)并改变类路径与类路径'com.android.tools.build:gradle:1.3.+'

+0

已完成但仍无法编译23.0.0 rc1 – Akshay

+0

更新工具 –

2

我遵循Jorge的帖子截图。但没有API 21作为选项。所以我保持编译的SDK版本'API 22:Android 5.1(Lollipop)'原样并且将生成工具版本从23.0.0 rc1更改为22.0.1

我还必须安装JDK 7,因为22.0.1没有支持JDK 6.之后,gradle构建成功。

enter image description here enter image description here

1

以我的经验,没有关于编译SDK版本构建工具版本,是关于新项目结构。据此issue,Aidl文件应该是在src/main/aidl,一旦你把* .aidl放在假定的目录下,Android Studio就会按照期望的那样服务它。

而且如果你想拥有它们的src/main/java中,那么你需要重新映射指令为你指定,如下图所示:

sourceSets { 
    main { 
     aidl.srcDirs = ['src/main/java'] 
    } 
} 

顺便说一句,在我的情况,重新映射方法只能通过Gradle 2.4(也可能高于版本)工作。

15

对于那些你仍然得到“AIDL缺少”错误:

对我来说,设置回构建工具的版本是不是所有的解决方案。

在您顶级的build.gradle文件,尝试设置: classpath 'com.android.tools.build:gradle:1.3.0' classpath 'com.google.gms:google-services:1.3.1'

,然后使用buildToolsVersion '23.0.1'

它对我来说非常合适。我希望它能帮助别人。

+0

此解决方案对我有很大帮助。 – validcat