简体   繁体   中英

compiler sdk version and target sdk version change in Android studio

I installed Android Studio 1.4 .By default it has settings for compiler sdk and target sdk as MARSHMALLOW . So if i generated final APK after completion of my project, is it works in previous versions of android with out any error ..??

No Absolutely Not

To work fine you have to mention target sdk like

    minSdkVersion 19
    targetSdkVersion 21
    versionCode 1
    versionName "1.0"

in Manifest file OR in build.gradle file.

My build.gradle contains

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
    applicationId "com.everestek.login"
    minSdkVersion 19

    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

}

Your compile SDK version must match the support library's major version.

Since you are using version 23 of the support library, you need to compile against version 23 of the Android SDK.

Alternatively you can continue compiling against version 22 of the Android SDK by switching to the latest support library v22.

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.example.suhasbachewar.demo"
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'    
}

它将完美运行。您所要做的只是将minSdkVersion更改为16或您想要扩展支持的任何级别.Compile SDK版本是用于使用构建工具进行编译的。它没有问题。您可以为较早的版本提供支持设备。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM