Error creating new Android project

1

I just created a new project Android with Android Studio I chose the minimum SDK that is 9 (Gingerbread) and the activity that be a 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 of what Android Studio itself has created and I also have updated the SDK with the latest versions.

Any suggestions?

EDIT: 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'
}
    
asked by Joacer 16.08.2017 в 13:13
source

3 answers

1

Regarding the message:

  

Manifest merger failed: uses-sdk: minSdkVersion 9 can not 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

Suggest that you have at least one minSdkVersion version 14 defined, since one element, in this case the support library for design ('com.android.support:design:26.+') requires this version at least to work properly, one option is to change to:

minSdkVersion 14

Another option is to return to version 25 that the design support library ('com.android.support:design:25.0.0') can work with minSdkVersion 9

As the message suggests you can add in your AndroidManifest.xml

<uses-sdk tools:overrideLibrary="android.support.design"/>

this to force it to work with API Level 9 but even if it works, you will notice strange behaviors for example in this version or less than API 14, for example:

CardViews with rounded corners in a device 2.3 will show only squares, elevation will not be displayed.

    
answered by 16.08.2017 / 16:53
source
3

I have found two solutions to eliminate this error, but I do not know which will be the most correct

I) downloading the version, for that 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 , for this 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>
    
answered by 16.08.2017 в 13:44
2

The library com.android.support:design:26.+ requires a minimum of sdk 14 but your project the minimum sdk is 9. To work your project must be equal or greater. Try looking for a compact of the library for compatibility with the sdk level of your project.

    
answered by 16.08.2017 в 13:25