Dev X
Dev X

Reputation: 363

How to build app supports Old SDK Versions (minSdkVersion) in android

When creating new project by wizard and gives errors, then it is so frustrated.

I just create new project with MinSdk = 9 to make the app run on gingerbread this gives me 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:appcompat-v7:26.0.0-alpha1] C:\Users\USER\.android\build-cache\dfb3187f39ea1ff94009f5d34353fff5cfc3daee\output\AndroidManifest.xml
    Suggestion: use tools:overrideLibrary="android.support.v7.appcompat" to force usage

and here is the gradle file

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.0"
    defaultConfig {
        applicationId "com.example.com.testApp"
        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.0.0-alpha1'
    testCompile 'junit:junit:4.12'
}

how to fix this?

Upvotes: 4

Views: 9112

Answers (2)

tapsey
tapsey

Reputation: 454

Remove this compile 'com.android.support:appcompat-v7:26.0.0-alpha1'

Or change compileSdkVersion 26 to compileSdkVersion 25 and use a library from that version

Upvotes: 1

Kamil
Kamil

Reputation: 346

You have to use the older version of the support library.

compileSdkVersion 25

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

As you can find out in the releases notes for 26.0.0 here

Note: The minimum SDK version has been increased to 14. As a result, many APIs that existed only for API < 14 compatibility have been deprecated. Clients of these APIs should migrate to their framework equivalents as noted in the reference page for each deprecated API.

Upvotes: 7

Related Questions