我正在尝试使用适用于 Android 的 Gradle 插件 0.10.0 版中提供的这项新功能。但我不断收到此错误消息:
FAILURE: Build failed with an exception.
- What went wrong: Execution failed for task ':xxxxxx:processDebugManifest'.
Manifest merger failed : uses-sdk:minSdkVersion 1 cannot be smaller than version 7 declared in library com.android.support:appcompat-v7:19.1.0
这是我的build.gradle
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion '19.0.3'
useOldManifestMerger false
defaultConfig {
minSdkVersion 9
targetSdkVersion 19
}
buildTypes {
release {
runProguard true
proguardFile 'proguard-zap.cfg'
signingConfig signingConfigs.release
debuggable false
zipAlign true
}
debug {
packageNameSuffix ".debug"
debuggable true
runProguard false
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile fileTree(dir: 'libs')
compile 'com.android.support:appcompat-v7:+'
compile 'com.google.android.gms:play-services:+'
compile 'com.google.code.gson:gson:+'
androidTestCompile files('libs/espresso-1.1-bundled.jar')
}
我该如何解决?
最佳答案
我有同样的错误。 作为临时修复,您可以将其添加到您的 list 文件中:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19"
tools:replace="minSdkVersion, targetSdkVersion"/>
工具命名空间声明如下:xmlns:tools="http://schemas.android.com/tools"
。此修复的缺点是您必须使 build.gradle 和 list 与 minSdkVersion
和 targetSdkVersion
中的值保持同步。希望它会在 0.10.1 中得到修复。
关于android - useOldManifestMerger 导致构建错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23430108/