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
Solution 1:
Note: This has been updated to reflect the release of API 21, Lollipop. Be sure to download the latest SDK.
In one of my modules I had the following in build.gradle:
dependencies {
compile 'com.android.support:support-v4:+'
}
Changing this to
dependencies {
// do not use dynamic updating.
compile 'com.android.support:support-v4:21.0.0'
}
fixed the issue.
Make sure you're not doing a general inclusion of com.android.support:support-v4:+
or any other support libraries (v7, v13, appcompat, etc), anywhere in your project.
I'd assume the problem is v4:+
picks up the release candidate (21.0.0-rc1) latest L release which obviously requires the L SDK.
Edit:
If you need to use the new views (CardView, RecyclerView, and Palette), the following should work:
compile "com.android.support:cardview-v7:21.0.0"
compile "com.android.support:recyclerview-v7:21.0.0"
compile "com.android.support:palette-v7:21.0.0"
(Credit to EddieRingle on /androiddev - http://www.reddit.com/r/androiddev/comments/297xli/howto_use_the_v21_support_libs_on_older_versions/)
Another Edit
Be sure to see @murtuza's answer below regarding appcompat-v7 and upvote if it helps!
Solution 2:
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.
Solution 3:
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:+'
tocompile 'com.android.support:support-v4:20.+'
inbuild.gradle
. This will prevent gradle from usingv4: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
Solution 4:
<uses-sdk tools:node="replace" />
No longer works.
change uses-sdk
to
<uses-sdk tools:overrideLibrary="com.packagename.of.libary.with.conflict" />
and addxmlns:tools="http://schemas.android.com/tools"
in the AndroidManifest.xml file