Android 带有 SDK 24 的 Studio 2.2.2 中的导航抽屉不支持 API 19

Navigation drawer in Android Studio 2.2.2 with SDK 24 does not support API 19

我在我的项目中使用 Android Studio 2.2.2 和 Android SDK 24。当我在 KitKat 4.4.2 中安装我的应用程序时,应用程序 运行 正确 - 除非我单击导航抽屉中打开 activity 的按钮。这样做会使应用程序崩溃。

这是gradle(module:app)当sdktoolbuildversion是19.1时

apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion '19.1'
defaultConfig {
    applicationId "com.sudan.myapplication"
    minSdkVersion 15
    targetSdkVersion 24
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.google.android.gms:play-services-maps:6.5.87'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'de.hdodenhof:circleimageview:2.2.0'
testCompile 'junit:junit:4.12'
}

消息是:

Information:Gradle tasks [:app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources] Error:Execution failed for task ':app:processDebugResources'. com.android.ide.common.process.ProcessException: Failed to execute aapt

如何在 API 19 中将我的应用配置为 运行?

我强烈建议始终通过使用 Android SDK 管理器下载最新版本来更新您的构建工具组件,在执行此操作之前,单击 Help-Check for Updates 获取最新的 android 工作室和插件版本。

compileSdkVersion 28
buildToolsVersion '19.1' //comment or delete this line
                         //If you're using Android plugin for Gradle 3.0.0 or higher
                         //your project automatically uses a default version of the build tools
defaultConfig {
    applicationId "com.sudan.myapplication"
    minSdkVersion 15
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

如果您不想执行上述步骤,请尝试以下操作:

compileSdkVersion 24
buildToolsVersion '24.2.1' //modify this


compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.google.android.gms:play-services-maps:6.5.87'
compile 'com.android.support:cardview-v7:24.2.1' //same as appcompat-v7
compile 'de.hdodenhof:circleimageview:2.2.0'
testCompile 'junit:junit:4.12'