[android] Manifest merger failed : uses-sdk:minSdkVersion 14

Since downloading the latest SDK and installing Android Studio, my project fails to build. I get the following message:

Error:Gradle: Execution failed for task ':SampleProject:processProdDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 14 cannot be smaller than version L declared in library com.android.support:support-v4:21.0.0-rc1

The answer is


Don't forget, you should edit build.gradle in 'app' subfolder of your project, not in project's folder. I've lost a working day trying to solve a problem with version "L".


I have the second solution:

  1. unzip https://dl.dropboxusercontent.com/u/16403954/android-21.zip to sdk\platforms\
  2. change build.gradle like

    compileSdkVersion 21
    buildToolsVersion "20.0.0"
    
    defaultConfig {
        applicationId "package.name"
        minSdkVersion 10
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    
  3. add

    <uses-sdk tools:node="replace" /> 
    

    in Manifest with xmlns:tools="schemas.android.com/tools";

  4. Go to sdk\extras\android\m2repository\com\android\support\support-v4\21.0.0-rc1\

unpack support-v4-21.0.0-rc1.aar and edit AndroidManifest.xml like

from

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

to

<uses-sdk
        android:minSdkVersion="4"
        android:targetSdkVersion="21" />

P.S. You can do this with all support libraries that need.


<uses-sdk tools:node="replace" />

No longer works.

change uses-sdk to

<uses-sdk tools:overrideLibrary="com.packagename.of.libary.with.conflict" />

and add
xmlns:tools="http://schemas.android.com/tools" in the AndroidManifest.xml file


I solved the problem by editing the line below in build.gradle and it works! :-)

adding version 20.+'

From

 dependencies {
        compile 'com.android.support:appcompat-v7:+'
    }

To

dependencies {
    compile 'com.android.support:appcompat-v7:20.+'
}

I make all of the solutions in here with no result, so i look in another place and i found a way to trick the IDE, so you have to put a line in the Mainfest to make the Gradle use a different one, the one that you put on build.gradle the line is:

<uses-sdk tools:node="replace" />

just it, and it work.

I hope it helps.


Here's the new bug filed for this btw https://code.google.com/p/android/issues/detail?id=72430

Assuming you are using the Support Repository, the workaround is to comment or remove the line

21.0.0-rc1 in the local Maven repo listing file at /extras/android/m2repository/com/android/support-v4/maven-metadata.xml


Solution: Manifest merger failed Attribute application@ppComponentFactory ...

If you are using any latest & greatest Firebase libraries or any other libraries, those are actually using AndroidX instead of android.support then you might have the issue as Manifest merger failed!! So, in this case, your project needs to migrate to AndroidX. So follow the link: https://firebase.google.com/support/release-notes/android#update_-_june_17_2019

Or watch this video. https://youtu.be/RgveQ4AY1L8 Thank you.


I also had the same issue and changing following helped me:

from:

dependencies {
    compile 'com.android.support:support-v4:+'

to:

dependencies {
 compile 'com.android.support:support-v4:20.0.0'
}

I have some projects where I prefer to target L.MR1(SDKv22) and some projects where I prefer KK(SDKv19). Your result may be different, but this worked for me.

// Targeting L.MR1 (Android 5.1), SDK 22
android {
    compileSdkVersion 22
    buildToolsVersion "22"

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 22
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    // google support libraries (22)
    compile 'com.android.support:support-v4:22.0.0'
    compile 'com.android.support:appcompat-v7:22.0.0'
    compile 'com.android.support:cardview-v7:21.0.3'
    compile 'com.android.support:recyclerview-v7:21.0.3'
}



// Targeting KK (Android 4.4.x), SDK 19
android {
    compileSdkVersion 19
    buildToolsVersion "19.1"

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 19
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    // google libraries (19)
    compile 'com.android.support:support-v4:19.1+'
    compile 'com.android.support:appcompat-v7:19.1+'
    compile 'com.android.support:cardview-v7:+'
    compile 'com.android.support:recyclerview-v7:+'
}

Also, in case you are importing the appcompat-v7 library make sure you tag a version number at the end of it like so:

compile 'com.android.support:support-v4:19.+'
compile 'com.android.support:appcompat-v7:19.+'

After only changing the support-v4 version, I still received the error:

Manifest merger failed : uses-sdk:minSdkVersion 15 cannot be smaller than version L declared in library com.android.support:support-v4:21.0.0-rc1

It was a bit confusing because it looks like v4 is still the problem, but, in fact, restricting the appcompat v7 version fixed the problem.


Thank you @Murtuza. Your answer helped me to solve my problem but in my case

compile 'com.android.support:support-v13:19.+ also, along with

compile 'com.android.support:support-v4:19.+' compile 'com.android.support:appcompat-v7:19.+'

from compile 'com.android.support:support-v4:+' compile 'com.android.support:support-v7:+' compile 'com.android.support:support-v13:+' Hope this might help some one


Adding to the correct answers above, the problem still might occur due to library nesting. In this case, try as the example below:

compile 'com.android.support:support-v4:20.+'
compile ('com.github.chrisbanes.actionbarpulltorefresh:extra-abs:+') { // example
    exclude group: 'com.android.support', module:'support-v4'
    exclude group: 'com.android.support', module:'appcompat-v7'
}

Just target the required minSdkVersion i.e change to the needed one In my case minSdkVersion was 14.

Changing to minSdkVersion 16 solved the issue

compileSdkVersion 29
    defaultConfig {
        applicationId "e.futaaapp"
        minSdkVersion 14
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

compileSdkVersion 29
    defaultConfig {
        applicationId "e.futaaapp"
        minSdkVersion 16
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

For people facing this issue in the Android Studio beta, the accepted answer didn't solve my problem. Importing a project downloaded from GitHub, I had the following in my build.gradle file of app giving an error in question:

 dependencies {
    compile 'com.android.support:support-v4:+'
}

But in my external library folder I have this folder:

support-v4-21.0.0-rc1 //note the 21

I solved the above problem by changing the dependency to:

dependencies {
compile 'com.android.support:support-v4:20.+' //20 used less than available strange but works
}

Note: you might also need to download api level lower than the currently available in Android Studio for some library and projects for this to work properly.


The only thing that worked for me is this:

In project.properties, I changed:

cordova.system.library.1=com.android.support:support-v4:+ to cordova.system.library.1=com.android.support:support-v4:20.+


compile('com.android.support:support-v4:19.1.0'){
    force = true
}

Helped me, taken from here


Solution 1:

Change uses-sdk to <uses-sdk tools:node="replace" /> and add xmlns:tools="http://schemas.android.com/tools" in AndroidManifest.xml

 <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.demo.android"
    android:versionCode="16"
    android:versionName="3.3.1">
    .
    .
    <uses-sdk tools:node="replace" />
    .
    .
</manifest>

Make sure you use gradle 0.11 and above to use Manifest merger.

Solution 2:

  • Change compile 'com.android.support:support-v4:+' to compile 'com.android.support:support-v4:20.+' in build.gradle. This will prevent gradle from using v4:21.0.0 that requires version L.

  • However, if your any of your external dependencies uses the same. You will probably have to wait for them to update the same.

Solution 3:

  • Remove/Comment <version>21.0.0-rc1</version> in your file <android-sdk>/extras/android/m2repository/com/android/support-v4/maven-metadata.xml

  • Repeat the same for support-v7


For me the issue like this is solved by changing the

minSdkVersion 14

In the build.gladdle file and use the one that is specified in the error message

but the issue was

Manifest merger failed : uses-sdk:minSdkVersion 14 cannot be smaller than version 15 declared in library

So I changed from 14 to 15 in the build.gladdle file and it works

give it a try.


Try deleting the build folder(s) in your project and resync your gradle project to rebuild it. Also, like others have said in this post - instead of doing something like this:

compile 'com.android.support:support-v4:19.+'

do this:

compile 'com.android.support:support-v4:19.1.0'

The problem still arises with transitive dependencies. Gradle offers a way to force the usage of a specific version of a dependency.

For example you can add something like:

configurations.all {
    resolutionStrategy {
        force 'com.android.support:support-v4:20.+'
        force 'com.android.support:appcompat-v7:20.+'
    }
}

to your build.gradle.

If you want to learn more about gradle resolution strategies refer to this guide http://www.gradle.org/docs/current/dsl/org.gradle.api.artifacts.ResolutionStrategy.html

I found this while reading the corresponding issue which I will link here


In Android Studio 1.1.0: File - Project Structure - Tab Flavors - Select Min SDK Version which is higher than in Manifest


for people building hybrid apps using cordova CLI, this command will help:

cordova build android -- --minSdkVersion=15

yes it uses double double dashes as you saw it.


In the build.gradle file, It was by default compile 'com.android.support:support-v4:+' so when you build the gradle projecit would consider, com.android.support:support-v4:21.0.0-rc1 because of the recent L developer preview release.

Make changes in the following line and it will resolve the issue. Change

compile 'com.android.support:support-v4:+' 

to

compile 'com.android.support:support-v4:20.+'

Similarly when using v7-appcompat support library, make the change from

compile 'com.android.support:appcompat-v7:+'

to

compile 'com.android.support:appcompat-v7:20.+'.

The best way is to let the Android Studio fix the issue.

I did the below, and it worked fine.

  1. Open your project in Android Studio, errors will be popup, if there is a link given to fix it click on it.

  2. Re-open your project in Android Studio, errors will be popup, there will be a link this time if it's not given in the Step 1, click on the given link to fix it.

Note that both operations took several minutes of time, but fixed all issues.


You need to remove from build.gradle compile 'com.android.support:support-v13:+'


You just change Minimum API Level from Build Settings -> Player Settings -> Other Settings -> Minimum SDK Level to some higher version.


You have to configure all the supports and appcompat libraries with version 19.+

If the recommendation of leave the support library with the 19.+ version doesn't works you can try the next tip in your AndroidManifest file.

First add this code:

xmlns:tools="http://schemas.android.com/tools"

And then, at the application level (not inside application!)

<uses-sdk tools:node="replace" />

Examples related to android

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How to implement a simple scenario the OO way My eclipse won't open, i download the bundle pack it keeps saying error log getting " (1) no such column: _id10 " error java doesn't run if structure inside of onclick listener Cannot retrieve string(s) from preferences (settings) strange error in my Animation Drawable how to put image in a bundle and pass it to another activity FragmentActivity to Fragment A failure occurred while executing com.android.build.gradle.internal.tasks

Examples related to android-studio

A failure occurred while executing com.android.build.gradle.internal.tasks "Failed to install the following Android SDK packages as some licences have not been accepted" error Android Gradle 5.0 Update:Cause: org.jetbrains.plugins.gradle.tooling.util This version of Android Studio cannot open this project, please retry with Android Studio 3.4 or newer WARNING: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()' Flutter plugin not installed error;. When running flutter doctor ADB.exe is obsolete and has serious performance problems Android design support library for API 28 (P) not working Flutter command not found How to find the path of Flutter SDK

Examples related to android-gradle-plugin

WARNING: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()' Android Material and appcompat Manifest merger failed Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve Failed to resolve: com.google.firebase:firebase-core:16.0.1 com.google.android.gms:play-services-measurement-base is being requested by various other libraries Invoke-customs are only supported starting with android 0 --min-api 26 error: resource android:attr/fontVariationSettings not found Exception : AAPT2 error: check logs for details Could not resolve com.android.support:appcompat-v7:26.1.0 in Android Studio new project Failed to resolve: com.android.support:appcompat-v7:27.+ (Dependency Error)

Examples related to android-5.0-lollipop

Android changing Floating Action Button color Android Support Design TabLayout: Gravity Center and Mode Scrollable Android statusbar icons color Notification bar icon turns white in Android 5 Lollipop How can I change default dialog button text color in android 5 Lollipop : draw behind statusBar with its color set to transparent Android lollipop change navigation bar color CardView not showing Shadow in Android L App crashing when trying to use RecyclerView on android 5.0 How to change status bar color to match app in Lollipop? [Android]