Android Studio 中缺少 aidl

aidl is missing in Android Studio

我正在尝试 运行 Sample of Google Cloud Messaging for Android 使用 Android SDK 版本 6.0,API 23 现在示例使用了 API 22,但我想 运行 用于 API 23,所以我在应用程序级别 built.gradle 文件中所做的更改如下。

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 'Google Inc.:Google APIs:23'
    buildToolsVersion '23.0.0'

    defaultConfig {
        applicationId "gcm.play.android.samples.com.gcmquickstart"
        minSdkVersion 9
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'LICENSE.txt'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.gms:play-services-gcm:7.8.0'
    compile 'com.android.support:appcompat-v7:23.0.0'
    // Testing dependencies
    androidTestCompile 'com.android.support.test.espresso:espresso-core:2.1'
    androidTestCompile 'com.android.support.test:runner:0.2'
    androidTestCompile 'com.android.support:support-annotations:23.0.0'
}

我更新了Android Studio 到最新版本,但是现在出现了以下错误。

:app:compileDebugAidl FAILED
Error:Execution failed for task ':app:compileDebugAidl'.
> aidl is missing

对于 中给出的解决方案,我已尝试 link。

为了解决这个问题,我首先将构建工具更改为 23.0.1,如下所示:

compileSdkVersion 23
buildToolsVersion "23.0.1"

我的 targetSdkVersion 也改为 23。

并在顶级脚本中更新这些参数:

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

希望对您有所帮助。