Android Studio Manifest合并失败minSdkVersion错误

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

我试图在我的应用程序中添加一个依赖项,其中最低sdk版本比我的应用程序更新,所以我收到以下错误

错误:任务':app:processDebugManifest'的执行失败。

清单合并失败:uses-sdk:minSdkVersion 9不能小于库中声明的版本14建议:使用工具:overrideLibrary =“com.nononsenseapps.filepicker”强制使用

但我不知道在哪里添加该建议,所以我可以建立它。这就是我的build.gradle(Module:app)现在的样子

apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
    applicationId "com.codedspycamera.android"
    minSdkVersion 9
    targetSdkVersion 21
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.nononsenseapps:filepicker:+'
compile 'com.squareup.picasso:picasso:2.4.0'


}
android android-gradle build.gradle
3个回答
2
投票

com.nononsenseapps.filepicker仅适用于> = 14版本的Android设备。如果你强迫它在<14台设备上工作,我认为会崩溃。但无论如何,如果你想这样做,你应该强制使用主应用程序中的minSdkVersion参数来覆盖库值。将建议行添加到主应用程序清单。 Read this for more information.


0
投票

只是为了让每个人都能更清楚地了解这是你必须要做的事情

工具:overrideLibrary标记

一种特殊的标记,只能与uses-sdk声明一起使用,以覆盖导入库,该库的最低SDK版本比该应用程序的最低SDK版本更新。没有这样的标记,清单合并将失败。该标记将允许用户选择可以导入哪些库而忽略最低SDK版本。

例如,在主要的android清单中:

 <uses-sdk android:targetSdkVersion="14" android:minSdkVersion="2"
          tools:overrideLibrary="com.example.lib1, com.example.lib2"/>

将允许导入具有以下清单的库而不会出现错误:

 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.lib1">
    <uses-sdk android:minSdkVersion="4" />
</manifest> 

请注意,如果添加多个库,则必须使用逗号“,”分隔它们。


0
投票

对于离子开发者

config.xml - 添加 -

 <preference name="android-minSdkVersion" value="19" />

bundle.gradle - 添加

configurations.all {
    resolutionStrategy {
        force 'com.android.support:support-v4:27.1.0'
    }
}
© www.soinside.com 2019 - 2024. All rights reserved.