android - list 合并失败 : uses-sdk:minSdkVersion 16 cannot be smaller than version 25 declared in library [Wear App sub-manifest]

标签 android android-gradle-plugin wear-os

我正在尝试向我现有的 android(最小 sdk 版本 16)应用添加一个可穿戴模块。 如果我运行应用程序( Release模式),我会收到此错误:

Error:Execution failed for task ':app:processReleaseManifest'. Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 25 declared in library [Wear App sub-manifest] c:\workspaces\sampleapp\android\app\build\generated\manifests\microapk\release\AndroidManifest.xml Suggestion: use tools:overrideLibrary="" to force usage

我不想增加 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'

可穿戴应用

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

注意:该错误仅发生在 Gradle 2.3.0 中。 Gradle 2.2.3 按预期工作......

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

最佳答案

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

android {
compileSdkVersion 30
defaultConfig {
    applicationId "com.oaics.customer"
    minSdkVersion 23
    targetSdkVersion 30
    versionCode 1
    versionName "1.0"
}

关于android - list 合并失败 : uses-sdk:minSdkVersion 16 cannot be smaller than version 25 declared in library [Wear App sub-manifest],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42683537/

相关文章:

android - 如何向 Android Wear 模拟器发送通知

android - Android Wear 是否支持 Android Studio 中的 C++ (JNI)?

android - 在 Android Studio 中指定特定文件夹作为 jni 源的父级

android - 应用程序 :transformClassesWithDexForDebug exception and java. util.concurrent.ExecutionException

android - WearableListView如何预选一个item?

Android - 通过触摸选择游戏板中的图 block ?

gradle - 无法获得任务的未知属性 'runTasks'

android - 如何使用 CursorLoader 填充微调器?

android - 如何在android中将视频格式mov转换为3gp或mp4

android - 使用 FFmpeg Android 更改音频音量