清单合并失败:uses-sdk:minSdkVersion 16不能小于库中声明的版本25 [Wear App子清单]

die*_*ter 5 android android-gradle-plugin wear-os

我正在尝试将可穿戴模块添加到我现有的android(最低SDK版本16)应用中。如果我运行应用程序(发布模式),则会收到此错误:

错误:任务':app:processReleaseManifest'的执行失败。清单合并失败:uses-sdk:minSdkVersion 16不能小于库中声明的版本25 [Wear App子清单] c:\ workspaces \ sampleapp \ android \ app \ build \ generated \ manifests \ microapk \ release \ AndroidManifest.xml建议:使用tools:overrideLibrary =“”强制使用

我不想增加minSdkVersion。那么,如何在不更改我的应用程序minSdkVersion的情况下解决问题?

这是我的gradle文件:

手机应用

apply plugin: 'com.android.application'

android {
    signingConfigs {
        config {
            [...]
        }
    }

    compileSdkVersion 25
    buildToolsVersion "25.0.2"

    repositories {
        jcenter()
        maven {
            url "https://maven.java.net/content/groups/public/"
        }
    }
    defaultConfig {
        applicationId "com.sample.app"
        minSdkVersion 16
        targetSdkVersion 25
        signingConfig signingConfigs.config
    }
    buildTypes {
        release {
            debuggable true
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            debuggable true
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:25.2.0'
    compile 'com.android.support:design:25.2.0'
    [...]

    compile 'com.google.android.gms:play-services-wearable:10.2.0'
    wearApp project(':sample-wear')
}

apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)

可悲的应用

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"

    signingConfigs {
        config {
            [...]
        }
    }

    defaultConfig {
        applicationId "com.sample.app"
        minSdkVersion 23
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        signingConfig signingConfigs.config
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.google.android.support:wearable:2.0.0'
    compile 'com.google.android.gms:play-services-wearable:10.2.0'
    provided 'com.google.android.wearable:wearable:2.0.0'
}
Run Code Online (Sandbox Code Playgroud)

注意:该错误仅在Gradle 2.3.0中发生。Gradle 2.2.3可以正常工作...

关于code.google.com的类似问题:https : //code.google.com/p/android/issues/detail? id = 232834

sam*_*in 6

在你的 gradle 文件中只需将 minSdkVersion 更新为 23

android {
compileSdkVersion 30
defaultConfig {
    applicationId "com.oaics.customer"
    minSdkVersion 23
    targetSdkVersion 30
    versionCode 1
    versionName "1.0"
}
Run Code Online (Sandbox Code Playgroud)


pio*_*543 0

这似乎是 Gradle 的问题,因为你的“可穿戴”模块具有最低23sdk,而不是 25。

请同时检查AndroidManifest.xml该模块,因为它可能包含 uses-sdk:minSdkVersion“25”。

如果没有值,您可以将其添加到其中覆盖 Gradle 配置值。

希望它会有所帮助。