Joacer
Joacer

Reputation: 568

Error creating new Android project with Android Studio

I just created a new project Android with Android Studio and I have chosen the minimum SDK 9 (Gingerbread) and the activity NavigationDrawer Activity, once chosen and created the project I get the following error:

Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 9 cannot be smaller than version 14 declared in library [com.android.support:design:26.0.0-alpha1] C:\xxx\xxx\.android\build-cache\bd439271136a9bc6f4bc228104359605401bab70\output\AndroidManifest.xml
    Suggestion: use tools:overrideLibrary="android.support.design" to force usage

And I have not touched anything or modified anything that has created the Android Studio itself and I have updated the SDK with the latest versions.

Any suggestion?

Gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "xx.xx.xx.seguros"
        minSdkVersion 9
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.android.support:design:26.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
}

Upvotes: 1

Views: 506

Answers (3)

Bhuvanesh BS
Bhuvanesh BS

Reputation: 13627

What happening inside it is. The Library support design using the minimum SDK version 14. So you can't use this library if your app minimumSdk version lower than that.

You should use com.android.support:design:25.+ to support minSdkVersion 9.

If you use com.android.support:design:26.0.0-alpha1. You must use minSdkVersion 14

Update your gradle like this.

compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
    applicationId "xx.xx.xx.seguros"
    minSdkVersion 14      // Update it to 14
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

Hope it helps:)

Upvotes: 1

Nazim ch
Nazim ch

Reputation: 854

apply plugin: 'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion "26.0.0" //change 
defaultConfig {
    applicationId "xx.xx.xx.seguros"
    minSdkVersion 14 //change
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
   }

}

hope it helps

Upvotes: 1

Joacer
Joacer

Reputation: 568

I have found two solutions to eliminate this error, but I don't know which one will be the most correct

I) Downloading the version, for this you have to modify the build.gradle using version 25 instead of 26 as follows:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "xx.xx.xx.seguros"
        minSdkVersion 9
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.+'
    compile 'com.android.support:design:25.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
}

II) Using tools: overrideLibrary, you have to modify the manifest by adding the following:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="es.uv.lisitt.seguros"
    xmlns:tools="http://schemas.android.com/tools">

    <uses-sdk tools:overrideLibrary="android.support.design, android.support.v7.appcompat,android.support.graphics.drawable, android.support.v7.recyclerview, android.support.v4, android.support.mediacompat, android.support.fragment, android.support.coreui, android.support.coreutils, android.support.compat"/>

     .....
</manifest>

Upvotes: 1

Related Questions