Android Studio清单合并失败minSdkVersion错误
我正在尝试在我的应用程序中添加一个依赖项,该依赖项的sdk版本比我的应用程序新,因此我收到以下错误消息
I am trying to add a dependency in my app which has the minimum sdk version newer than my apps so I am getting the following error
错误:任务':app:processDebugManifest'的执行失败.
Error:Execution failed for task ':app:processDebugManifest'.
清单合并失败:uses-sdk:minSdkVersion 9不能小于库中声明的版本14 建议:使用tools:overrideLibrary ="com.nononsenseapps.filepicker"强制使用
Manifest merger failed : uses-sdk:minSdkVersion 9 cannot be smaller than version 14 declared in library Suggestion: use tools:overrideLibrary="com.nononsenseapps.filepicker" to force usage
但是我不知道在哪里添加该建议,因此我可以构建它. 这就是我的build.gradle(Module:app)现在的样子
but I don't know where to add that suggestion so I can build it. This is how my build.gradle(Module: app) looks right now
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'
}
只是让每个人都清楚答案,这就是您要做的
Just to make the answer more clear for everyone this is what you have to do
tools:overrideLibrary标记
tools:overrideLibrary marker
一个特殊标记,只能与uses-sdk声明一起使用,以覆盖导入其最低SDK版本比该应用程序的最低SDK版本更新的库. 没有这样的标记,清单合并将失败.该标记将允许用户选择要导入的库,而忽略最低的SDK版本.
A special marker that can only be used with uses-sdk declaration to override importing a library which minimum SDK version is more recent than that application's minimum SDK version. Without such a marker, the manifest merger will fail. The marker will allow users to select which libraries can be imported ignoring the minimum SDK version.
示例,在主要的Android清单中:
Example, In the main android manifest :
<uses-sdk android:targetSdkVersion="14" android:minSdkVersion="2"
tools:overrideLibrary="com.example.lib1, com.example.lib2"/>
将允许导入具有以下清单的库而不会出现错误:
will allow the library with the following manifest to be imported without error :
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.lib1">
<uses-sdk android:minSdkVersion="4" />
</manifest>
请注意,如果添加了多个库,则必须用逗号,"分隔它们
Note that the if multiple libraries are added than they must be separated with a comma ","