user1611830
user1611830

Reputation: 4857

AndroidManifest mismatch

I think I have some AndroidManifest mismatch. When I try to build with Gradle, I get this

[/home/TryIt/app/src/main/AndroidManifest.xml:3, /var/folders/_h/gq0mh1154p76krbwrkj75qbm0000gn/T/manifestMerge2745402073170024437.xml:2] Main manifest has <uses-sdk android:targetSdkVersion='18'> but library uses targetSdkVersion='19'
:app:processDebugManifest FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merging failed. See console for more info.

In the library manifest I have <uses-sdk android:minSdkVersion="7"/> and its build.gradle sets

compileSdkVersion 18
    buildToolsVersion "19.0.1"

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 18
    } 

On the other hand in the app/src/main/AndroidManifest manifest I have <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="18" />

What am I missing ?

Upvotes: 2

Views: 2254

Answers (3)

Michael
Michael

Reputation: 2250

I had this error and the simple answer is because I had minSdkVersion 4 in my build.gradle.

Changing it to minSdkVersion 8 8 fixed this for me.

Upvotes: 0

Piyush Agarwal
Piyush Agarwal

Reputation: 25858

In gradle build system the minSdkVersion and targetSdkVersion defined in AndroidManifest.xml will be replaced by what you define in your build.gradle file, so I recommend you to remove <uses-sdk /> from AndroidManifest.xml and keep them in only build.gradle files to avoid confusions.

You are getting merging failed error because the minSdkVersion and targetSdkVersion in different modules are not equal. minSdkVersion and targetSdkVersion must be equal in all build.gradle files inside a project.

EDIT :

Note : Don't set minSdkVersion = 7 to anywhere because most of the libraries like Google Play Services and all are using minSdkVersion =8. So try to use minSdkVersion = 8 everywhere in you app.

Check your Gradle Console output for detailed report of conflicts. It will show which files in the project are cause of this error.

Upvotes: 2

epsilones
epsilones

Reputation: 11609

I have ran a similar issue with some project when updating my Android-Studio to the last version. Try to set the targetSdkVersion to 19 in all your gradle files

Upvotes: 2

Related Questions