Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Got the above error after downloading L preview release version in Android Studio, when my project had minSdkVersion 19.

Furthermore, when setting mindSdkVersion as below:

defaultConfig {
....
          minSdkVersion 'L'
....
    }

I get dozens of errors as below, regarding resources from AppCompat-v7-21 :

/home/user/workspace/project/build/intermediates/exploded-aar/com.android.support/appcompat-v7/21.0.0-rc1/res/values-v21/values.xml
Error:Error retrieving parent for item: No resource found that matches the given name '@android:TextAppearance.Material.SearchResult.Subtitle'.

So I have 2 questions:

  1. Why does AS complain about minSdkVersion ? I presume because AppCompat-v7 21 supports only L release; but why ? Also, will it support only L release when it is going to be officially released in autumn too ? Because that would be a problem... Or is it just a temporary restriction in order for apps not be be pushed to Play Store, as specified in the Google I/O 2014 Keynote ?
  2. Why does AppCompat-v7 21 complain about those errors, as I already set mindSdkVersion to L ?
like image 901
Bogdan Zurac Avatar asked Jun 26 '14 17:06

Bogdan Zurac


5 Answers

compileSdkVersion 'android-L'

BOOM. Done.

LAST EDIT: As of Android 5.0 release, this is no longer an issue, just target API level 21 directly.

Edit for clarity: Indeed as David_E specified below, this solution only works for L version, if you try to deploy the app on a device below L (ex <=4.4.4) it will complain of OLD_SDK. In order for the app to work pre-L you still need to use the old v20 support lib + app compat + targetVersionSdk and compileVersionSdk

dependencies {

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

    android {
        compileSdkVersion 20
        buildToolsVersion '20'

        defaultConfig {
            applicationId "com.example.application"
            minSdkVersion 10
            targetSdkVersion 20
            versionCode 1
            versionName "1.0"
        }
}
like image 197
Bogdan Zurac Avatar answered Oct 16 '22 10:10

Bogdan Zurac


To force working with a working version Just change the gradle dependencies like this:

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

was:

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

N.B.

I updated Tools & Extras in the SDK manager.

after the project was broken I fixed it as shown above.

For now I do not update android L & 4.4W (enough bugs for today :-( )

like image 4
BubbaGum Avatar answered Oct 16 '22 12:10

BubbaGum


Thanks David for your answer!

I had to change

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

To:

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

And everything work perfect now.

like image 2
user3091593 Avatar answered Oct 16 '22 11:10

user3091593


The answer stated here may not work properly, as it will make your app only work for Android L.

In order to conserve the backward compatibility with older Android OS versions, change the gradle dependecy

From:

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

To:

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

Note that the error complains about com.android.support:appcompat-v7:21.0.0-rc1, the reason for that is that using appcompat-v7:+ will tell gradle to import the latest dependency of the appcompat-v7 library, unfortunately this latest version is only working for Android L, so we have to point to a previous version.

Hopefully Google will fix this in the near future.

like image 32
David_E Avatar answered Oct 16 '22 11:10

David_E


The way that worked for me was to install the Android Studio Beta (Not Preview Release, the Beta was launched today as part of IO).

Uninstall the preview release and install the Beta and open your project. It will ask you to use project SDK or Studio SDK, use Android Studio's SDK.

Go to your projects local.properties file and where you have sdk.dir ensure that any backslashes () are doubled up .e.g. \.

Go to Project Structure > SDK and ensure this pointing to the Android SDK on my Pc it was C:\Program Files(x86)\Android\android-studio\SDK.

Then in your projects and any libraries you have build.gradle files where you have

compile 'com.android.support:support-v4 Change it to compile 'com.android.support:support-v4:20+

Resync the gradle files and all fixed

like image 4
Boardy Avatar answered Oct 16 '22 11:10

Boardy