降级Android SDK(api 23 - > api 21)

Paw*_*ęba 5 sdk android gradle

由于SDK API 23(Marshmallow)中的权限存在一些问题,我想切换回API 21,但我遇到了一些问题......我已经阅读了很多有类似问题的帖子并试过(几乎我猜)一切:我已经更新了所有SDK构建/平台工具,API 21,Suport和Repository Libraries的功能.然后我清理了项目,重建并同步.然而,我收到了这些错误: 在此输入图像描述

我的build.gradle如下所示:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"
    defaultConfig {
        applicationId "com.example.pablo.appcontacts"
        minSdkVersion 19
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.jakewharton:butterknife:7.0.1'
    compile 'com.android.support:appcompat-v7:23.1.1'
}
Run Code Online (Sandbox Code Playgroud)

我对此不是很熟悉,任何人都可以帮我解决这个问题我真的找不到办法......?

jos*_*jan 4

3 步骤:

1 编辑build.grade

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.stackoverflow.answer"
        minSdkVersion 16
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

dependencies {
    androidTestCompile 'junit:junit:4.12'
    compile fileTree(dir: 'libs', include: ['*.jar'])
}
Run Code Online (Sandbox Code Playgroud)

2 同步渐变按钮

3 重建项目