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

问题描述 投票:0回答:1

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

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

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

并且消息是:

信息:Gradle任务[:app:generateDebugSources,:app:mockableAndroidJar,:app:prepareDebugUnitTestDependencies,:app:generateDebugAndroidTestSources]错误:任务':app:processDebugResources'的执行失败。 com.android.ide.common.process.ProcessException:无法执行aapt

如何配置我的应用程序以在API 19中运行?

android navigation-drawer android-4.4-kitkat android-studio-2.2
1个回答
0
投票

我强烈建议通过使用Android SDK Manager下载最新版本来保持Build Tools组件的更新,在此之前,单击Help-Check for Updates以获取最新的android studio和插件版本。

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'
© www.soinside.com 2019 - 2024. All rights reserved.