Manifest merger error "uses-sdk:minSdkVersion X cannot be smaller than Y" for processDebugAndroidTestManifest

1,768 views
Skip to first unread message

Alex

unread,
May 11, 2015, 1:55:48 AM5/11/15
to adt...@googlegroups.com
I have a multi-project gradle build. 

  • 'Run" from Android Studio is fine, the app is deployed
  • Clean and Make from AS fail with manifest merger error in processDebugAndroidTestManifest 
  • Everything works fine from the command line
  • There are no tests
The dependencies are as follows:

:app -> :lib1 -> :lib2

:app
minSdk=16,  AndroidManifestxml has tools:overrideLibrary="lib2's package"

:lib1 (aar)
minSdk=16

:lib2 (aar)
minSdk=19

Error:

/me/project/lib1/build/intermediates/manifests/tmp/manifestMerger5327563302608474252.xml:5:5 Error:
uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library /me/project/lib1/build/intermediates/exploded-aar/lib2/unspecified/AndroidManifest.xml
Suggestion: use tools:overrideLibrary="lib2" to force usage

* What went wrong:
Execution failed for task ':lib1:processDebugAndroidTestManifest'.
> java.lang.RuntimeException: Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library /.../lib1/build/intermediates/exploded-aar/android/lib2/unspecified/AndroidManifest.xml
  Suggestion: use tools:overrideLibrary="lib2" to force usage


When we open up this manifestMerger5327563302608474252.xml file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.me.lib1.test">

<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="22" />

<application>
<uses-library android:name="android.test.runner" />
</application>

<instrumentation android:name="android.test.InstrumentationTestRunner"
android:targetPackage="com.me.lib1.test"
android:handleProfiling="false"
android:functionalTest="false"
android:label="Tests for com.me.lib1.test"/>
</manifest>

So there seems to be a manifest for tests I do not have, or I am doing something wrong.

I appreciate any suggestions to resolve this.

Alex

unread,
May 11, 2015, 2:02:38 AM5/11/15
to adt...@googlegroups.com
I forgot to mention:

Android Studio 1.2.1.1
Gradle 2.4
Android gradle-plugin 1.2.3
Build Tools 22.0.1

Jerome Dochez

unread,
May 11, 2015, 11:38:27 AM5/11/15
to adt...@googlegroups.com
per you email : 

:app
minSdk=16,  AndroidManifestxml has tools:overrideLibrary="lib2's package"

:lib1 (aar)
minSdk=16

:lib2 (aar)
minSdk=19

you just cannot import a library which requires 19 as its mininum supported SDK version inside an application which can run on 16. The library code is not expecting to be run on anything below 19 and would be broken/disfunctional.

two possible fixes : 
1. change lib2 to have minSdk=16 
2. change app to be minSdk=19

HTH, Jerome

--
You received this message because you are subscribed to the Google Groups "adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adt-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michal Bendowski

unread,
May 11, 2015, 11:55:39 AM5/11/15
to adt...@googlegroups.com
If you really careful (i.e. make sure API is at least 19 before using the library code) you can also add this snippet to lib1's manifest (as suggested by the error message):

<uses-sdk xmlns:tools="http://schemas.android.com/tools"
tools:overrideLibrary="lib2" />
Reply all
Reply to author
Forward
0 new messages