I'm using the leanback libraries, which require Android 17 or later. However my app supports a minSDK of 16, so I get a build error from gradle saying
我使用的是leanback库,需要Android 17或更高版本。然而,我的应用程序支持一个16的minSDK,所以我从gradle得到一个构建错误。
Error:Execution failed for task ':Tasks:processPhoneDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 17 declared in library /Users/mike/Projects/android-for-dummies-v3/Tasks/build/intermediates/exploded-aar/com.android.support/leanback-v17/21.0.2/AndroidManifest.xml
Suggestion: use tools:overrideLibrary="android.support.v17.leanback" to force usage
When I look at the build tools documentation, I see how to add the overrideLibrary
marker to my manifest, but the problem is that I'm declaring my minSdk in my gradle file instead of in my manifest.
当我查看构建工具文档时,我看到了如何在清单中添加overrideLibrary标记,但问题是我在gradle文件中声明了我的minSdk,而不是在清单中声明。
How do I use overrideLibrary
when the minSdk is declared in build.gradle instead of in AndroidManifest.xml?
在构建minSdk时如何使用overrideLibrary。不使用AndroidManifest.xml?
5 个解决方案
#1
442
Open Android Studio -> Open Manifest File
开放Android Studio ->开放清单文件。
add <uses-sdk tools:overrideLibrary="android.support.v17.leanback"/>
don't forget to include xmlns:tools="http://schemas.android.com/tools"
too, before the <application>
tag
添加< uses-sdk工具:overrideLibrary = " android.support.v17。“leanback”/>不要忘记包含xmlns:tools="http://schemas.android.com/tools",在
#2
140
it doesn't matter that you declare your minSdk in build.gradle. You have to copy overrideLibrary
in your AndroidManifest.xml
, as documented here.
在build.gradle中声明minSdk并不重要。你必须在你的AndroidManifest中复制overrideLibrary。xml,记录在这里。
<uses-sdk tools:overrideLibrary="com.example.lib1, com.example.lib2"/>
The system automatically ignores the sdkVersion declared in AndroidManifest.xml.
系统会自动忽略AndroidManifest.xml中声明的sdkVersion。
I hope this solve your problem.
我希望这能解决你的问题。
#3
5
As library requires minSdkVersion 17
then you can change the same in build.gradle
(Module:Application) file:
当库需要minSdkVersion 17时,您可以在build.gradle(模块:应用程序)文件中更改相同的文件:
defaultConfig {
minSdkVersion 17
targetSdkVersion 25
}
and after that building the project should not throw any build error.
在此之后,项目不应该抛出任何构建错误。
#4
3
I just changed minSdkVersion="7"
in C:\MyApp\platforms\android\CordovaLib\AndroidManifest.xml
and it worked.
我只是把minSdkVersion="7"换成了C:\MyApp\ android\CordovaLib\AndroidManifest。xml和它工作。
Steps:
步骤:
- Path:
C:\MyApp\platforms\android\CordovaLib\AndroidManifest.xml
- 路径:C:\ MyApp \ \ \ CordovaLib \ AndroidManifest.xml android平台
- Value:
<uses-sdk android:minSdkVersion="7"/>
- 价值:< uses-sdk android:minSdkVersion = " 7 " / >
-
Ran command in new cmd prompt:
在新的cmd提示中运行命令:
C:\MyApp>phonegap build android --debug [phonegap] executing 'cordova build android --debug'... [phonegap] completed 'cordova build android --debug'
C:\MyApp>phonegap构建android——调试(phonegap)执行“cordova构建android——调试”……[phonegap]完成“cordova构建android——调试”
#5
1
<manifest xmlns:tools="http://schemas.android.com/tools" / .... />
<uses-sdk tools:overrideLibrary="nl.innovalor.ocr,
nl.innovalor.corelib" />
I was facing the issue of conflict between different min sdk versions. So this solution worked for me.
我面对的是不同的最小sdk版本之间的冲突问题。所以这个解对我有效。
#1
442
Open Android Studio -> Open Manifest File
开放Android Studio ->开放清单文件。
add <uses-sdk tools:overrideLibrary="android.support.v17.leanback"/>
don't forget to include xmlns:tools="http://schemas.android.com/tools"
too, before the <application>
tag
添加< uses-sdk工具:overrideLibrary = " android.support.v17。“leanback”/>不要忘记包含xmlns:tools="http://schemas.android.com/tools",在
#2
140
it doesn't matter that you declare your minSdk in build.gradle. You have to copy overrideLibrary
in your AndroidManifest.xml
, as documented here.
在build.gradle中声明minSdk并不重要。你必须在你的AndroidManifest中复制overrideLibrary。xml,记录在这里。
<uses-sdk tools:overrideLibrary="com.example.lib1, com.example.lib2"/>
The system automatically ignores the sdkVersion declared in AndroidManifest.xml.
系统会自动忽略AndroidManifest.xml中声明的sdkVersion。
I hope this solve your problem.
我希望这能解决你的问题。
#3
5
As library requires minSdkVersion 17
then you can change the same in build.gradle
(Module:Application) file:
当库需要minSdkVersion 17时,您可以在build.gradle(模块:应用程序)文件中更改相同的文件:
defaultConfig {
minSdkVersion 17
targetSdkVersion 25
}
and after that building the project should not throw any build error.
在此之后,项目不应该抛出任何构建错误。
#4
3
I just changed minSdkVersion="7"
in C:\MyApp\platforms\android\CordovaLib\AndroidManifest.xml
and it worked.
我只是把minSdkVersion="7"换成了C:\MyApp\ android\CordovaLib\AndroidManifest。xml和它工作。
Steps:
步骤:
- Path:
C:\MyApp\platforms\android\CordovaLib\AndroidManifest.xml
- 路径:C:\ MyApp \ \ \ CordovaLib \ AndroidManifest.xml android平台
- Value:
<uses-sdk android:minSdkVersion="7"/>
- 价值:< uses-sdk android:minSdkVersion = " 7 " / >
-
Ran command in new cmd prompt:
在新的cmd提示中运行命令:
C:\MyApp>phonegap build android --debug [phonegap] executing 'cordova build android --debug'... [phonegap] completed 'cordova build android --debug'
C:\MyApp>phonegap构建android——调试(phonegap)执行“cordova构建android——调试”……[phonegap]完成“cordova构建android——调试”
#5
1
<manifest xmlns:tools="http://schemas.android.com/tools" / .... />
<uses-sdk tools:overrideLibrary="nl.innovalor.ocr,
nl.innovalor.corelib" />
I was facing the issue of conflict between different min sdk versions. So this solution worked for me.
我面对的是不同的最小sdk版本之间的冲突问题。所以这个解对我有效。