Android Studio 修改api level

  1. Update build.gradle

Example of build.gradle: app/src/build.gradle

apply plugin:'com.android.application'

android {
    compileSdkVersion 20
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "com.courses.sottocorp.sunshine"
        minSdkVersion 10
        targetSdkVersion 20
        versionCode 1
        versionName "1.0"}
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'}}}

dependencies {
    compile fileTree(dir:'libs', include:['*.jar'])
    compile 'com.android.support:appcompat-v7:20.0.0'
    compile 'com.android.support:support-v4:20.0.0'}
  1. Sync gradle button
  2. Rebuild project

After updating the build.gradle minSdkVersion, you have to click on the button to sync gradle file ("Sync Project with Gradle files").

That will clear the market.

Updating manifest.xml, e.g. deleting any references to SDK levels in the manifest file, is NOT necessary anymore in Android Studio.

猜你喜欢

转载自jameskaron.iteye.com/blog/2170360