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

标签 android gradle sdk

由于 SDK API 23 (Marshmallow) 中的一些权限问题,我想切换回 API 21,但我遇到了一些问题......我已经阅读了很多有类似问题的帖子并尝试过(几乎我猜测)一切:我已经更新了所有 SDK 构建/平台工具、API 21 的功能、支持和存储库。然后我清理了项目,重建它并同步。然而,我收到了这些错误: enter image description here

我的 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'
}

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

最佳答案

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'])
}

2 同步渐变按钮

3 重建项目

关于android - 降级 Android SDK( api 23 -> api 21),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34098723/

相关文章:

java - 广播接收器使程序崩溃

java - Google App Engine/Java SDK 在哪里存储记录和 blob?

iphone - 我应该在我编写的每个文件中导入 UIKit 吗?

php - 通过 SDK 检索 Paypal 计划给出错误代码 400 - 无请求负载

.net - 使用 ksoap2 将参数传递给 .net Web 服务,始终传递 null(空)值

android - Android Vector 中的破折号 stroke-dasharray

android - 打算在我的 Activity 中选择一个安装缓慢的应用程序,为什么?

java - "compile project"的东西在发布到maven repository时不能带入aar

spring - 如果我在spring boot应用程序中未指定任何版本,gradle将下载哪个版本?

gradle - 在运行时配置Gradle任务