代码之家  ›  专栏  ›  技术社区  ›  sflee

如何在android studio中选择其他api级别?

  •  0
  • sflee  · 技术社区  · 7 年前

    我在跟踪这个 tutorial .

    我有渲染问题。通过在web上搜索,我发现api级别应该改成更低的版本, link .

    问题是我无法选择较低的API版本: enter image description here
    怎么解决?

    2 回复  |  直到 7 年前
        1
  •  1
  •   Diego Malone    7 年前

    您可以在应用程序上设置API级别 build.gradle 文件。打开它 ProjectFolder/app/build.gradle .

    由于android p api(api级别28)已启用,因此可以使用稳定的androidapi(如27)。 Developer Preview 阶段。

    android {
        compileSdkVersion 27
        defaultConfig {
            applicationId "com.example.app"
            minSdkVersion 21
            targetSdkVersion 27
            versionCode 1
            versionName "1.0"
        }
    }
    
        2
  •  0
  •   sflee    7 年前
    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 26
        defaultConfig {
            applicationId "com.example.myfirstapp"
            minSdkVersion 15
            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 {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'com.android.support:appcompat-v7:26.0.0'
        implementation 'com.android.support.constraint:constraint-layout:1.1.2'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.2'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    }
    

    最后,这是我的build.gradle。