android - useOldManifestMerger 导致构建错误

标签 android android-gradle-plugin

我正在尝试使用适用于 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 与 minSdkVersiontargetSdkVersion 中的值保持同步。希望它会在 0.10.1 中得到修复。

关于android - useOldManifestMerger 导致构建错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23430108/

相关文章:

android - Gradle Sync问题:连接被拒绝:连接

android - Gradle项目同步失败,如何解决?

android - Nexus 5 黑暗照片安卓相机

android - 无法在Android中设置自定义imageview的图像资源

android UI 元素没有出现

android - Gradle错误: “Failed to apply plugin [id ‘myappid’]”

java - 如何阻止元素影响 View 页面内的其他元素?

android - 从 Activity 返回大量数据的 "Android"方法是什么

android - 如何为单一风格签署发布和调试版本

android - 多个support-v4 jar导致问题