Sdk: minSdkVersion 15 cannot differ from the L version declared in the library

When creating an application

the following error occurs:

Error: Execution completed for task ': app: processDebugManifest'.

Failed to execute merge manifest: uses-sdk: minSdkVersion 15 cannot differ from L version declared in library C: \ Users \ Sybren-PC \ AndroidStudioProjects \ Tutorial \ app \ build \ intermediates \ exploded-aar \ com.android.support \ AppCompat-v7 \ 21.0.0-rc1 \ AndroidManifest.xml

I've tried some things in build.gradle

, but nothing seems to work.

The error message points to this file

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<!--
 Copyright (C) 2012 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="android.support.v7.appcompat" >

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

    <application />

</manifest>

      

AndroidManifest.xml (from my project)

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

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

      

Build.gradle (module: app)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "com.example.sybren_pc.tutorial"
        minSdkVersion 15
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.+'

}

      

Who can help fix this?

EDIT

This is what my build.gradle looks like. Now the gradle build is fine.

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.example.sybren_pc.tutorial"
        minSdkVersion 15
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.0'

      

Updates I made from SDK Manager: Android SDK Build Tools, Android Support Repository, Android Support Support

+3


source to share


1 answer


First, you stated in Manifest.xml

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

      

You can remove these lines altogether because it Gradle

overrides values Manifest

, so you can only specify versions in Gradle

( Source ).



And the error happened because compileSdkVersion

in build.gradle

lower than advertised in Manifest.xml

- he is complaining about it.

Second, in build.gradle

you are using buildToolsVersion = 20.0.0

but you want to compile it for SDK Version

= 21. This is not possible. You must update BuildTools

via SDK Manager

. Here's a doc on the latter Build Tools

, as well as a nice article to look at. Good explanation there.

Hope this solves your problem. Greetings.

+1


source







All Articles