Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle code not building: aidl is missing

I updated android studio from version 1.0 to 1.2.1 and when I started my first application the this appears.

Error:Execution failed for task ':app:compileDebugAidl'.

aidl is missing

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'
}
like image 815
user229977 Avatar asked Dec 05 '22 21:12

user229977


1 Answers

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:

  • an older version of the plugin. (<1.3.0-beta1)
  • latest build tools (23.0.0-rc1)
  • compileSDK 22

---> you will probably have this strange error : "aidl is missing" (even in projects not using aidl !)

Solution:

Be sure to use the latest android-gradle-plugin (in the root build.gradle) :

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

under buildscript-->dependencies.

Example :

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
    }
}

and the latest build tools (in module build.gradle):

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

BE AWARE that with this config you are using the latest build tools -not released yet- and the preview of Android-M ---> things can be unstable

like image 99
ben75 Avatar answered Dec 27 '22 16:12

ben75