How to create an app supports old SDK versions (minSdkVersion) in android

When the wizard creates a new project and gives errors, then he is so frustrated.

I just create a new project with MinSdk = 9 to make the app work on gingerbread it 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 it?

+3


source to share


2 answers


You must use an older version of the support library.

compileSdkVersion 25

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

      



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

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

+4


source


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



Or change compileSdkVersion 26

to compileSdkVersion 25

and use the library from that version

+1


source







All Articles