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
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.
How do I use overrideLibrary
when the minSdk is declared in build.gradle instead of in AndroidManifest.xml?
Open Android Studio -> Open Manifest File
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
it doesn't matter that you declare your minSdk in build.gradle. You have to copy overrideLibrary
in your AndroidManifest.xml
, as documented here.
<manifest
... >
<uses-sdk tools:overrideLibrary="com.example.lib1, com.example.lib2"/>
...
</manifest>
The system automatically ignores the sdkVersion declared in AndroidManifest.xml.
I hope this solve your problem.
<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.
As library requires minSdkVersion 17
then you can change the same in build.gradle
(Module:Application) file:
defaultConfig {
minSdkVersion 17
targetSdkVersion 25
}
and after that building the project should not throw any build error.
I just changed minSdkVersion="7"
in C:\MyApp\platforms\android\CordovaLib\AndroidManifest.xml
and it worked.
Steps:
- Path:
C:\MyApp\platforms\android\CordovaLib\AndroidManifest.xml
- Value:
<uses-sdk android:minSdkVersion="7"/>
Ran command in new cmd prompt:
C:\MyApp>phonegap build android --debug
[phonegap] executing 'cordova build android --debug'...
[phonegap] completed 'cordova build android --debug'
use this code in manifest.xml
<uses-sdk
android:minSdkVersion="16"
android:maxSdkVersion="17"
tools:overrideLibrary="x"/>