Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio: Gradle build fails -- Execution failed for task ':compileDebugAidl'

After changes to source and building with gradle in Android Studio (I/O preview) AI - 130.677228 the build fails with the following error:

Gradle: 
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileDebugAidl'.
> No signature of method: com.android.ide.common.internal.WaitableExecutor.waitForTasks() is applicable for argument types: () values: []
  Possible solutions: waitForAllTasks()
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Could not execute build using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'.

The second time running a build the build will succeed.

Using a gradle wrapper with version 1.6

This really sucks because it does a long build (non-incremental) after it fails the first time.

Is there a way to not have this failure?

EDIT to include build.gradle

buildscript {

    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.4'
    }
}
apply plugin: 'android'

task wrapper(type: Wrapper) {
    gradleVersion = '1.6'
}

dependencies {

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

android {
    compileSdkVersion "Google Inc.:Google APIs:17"
    buildToolsVersion "17"

    defaultConfig {
        minSdkVersion 11
        targetSdkVersion 17
    }
    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }

        instrumentTest.setRoot('tests')
    }
}

Link to issue on Google Code: https://code.google.com/p/android/issues/detail?id=56158

like image 351
seanmakesgames Avatar asked May 22 '13 02:05

seanmakesgames


People also ask

How do I enable tasks in Gradle?

Run a Gradle task in the Run Anything windowIn the Run Anything window, start typing a name of the task you want to execute. To execute several tasks, enter task names using space to separate each new task. Alternatively, scroll down to the Gradle tasks section and select the task you need.


3 Answers

I solved this issue by setting buildToolsVersion in my build.gradle file to match the latest version of the Android SDK Build-tools in the SDK manager.

Showing Build-tools version 22.0.1 is installed

In my case, I have the Android SDK Build-tools version 22.0.1 installed, so I set buildToolsVersion accordingly:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"
...

After making that change, my app builds uneventfully.

like image 88
bonh Avatar answered Oct 20 '22 00:10

bonh


I'm not sure how this is possible. It looks like you have a mismatch between the Gradle plugin itself and its dependencies that provides the WaitableExecutor class.

However you mention Gradle 1.5 and this is a problem.

The plugin version 0.3 was compatible with Gradle 1.3-1.4 The new version release last week, 0.4 is compatible with Gradle 1.6+

Make sure you use 0.4 and the new Gradle version.

like image 20
Xavier Ducrohet Avatar answered Oct 20 '22 01:10

Xavier Ducrohet


I was facing the same issue "Failed to execute the task: compileDebugaidl aidl/debug/".

I saw further in Gradle Console for the specifics and it read as below:

Failed to capture snapshot of output files for task 'prepareComAndroidSupportAppcompatV72103Library' during up-to-date check.

Could not remove entry '/Users/..../.../.../..../build/intermediates/exploded-aar/com.android.support/appcompat-v7/21.0.3' from cache outputFileStates.bin (/Users/..../..../..../.gradle/2.2.1/taskArtifacts/outputFileStates.bin).

I resolved it by deleting the outputFileStates.bin file from the terminal and allowed Gradle to recreate it.

Hope it helps somebody.

like image 26
Alfred Avatar answered Oct 19 '22 23:10

Alfred