从 SDK 23 降级到 22 android

downgrading from sdk 23 to 22 android

我决定将我的 api 级别从 23 级降低到 22 级。首先,我下载了 android 工作室并安装了最新的 23 API。我现在安装了 22 API 但我不知道我是否安装了其他东西,例如:

compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:design:22.2.0'

如果安装了这些,则无法找到查看位置...这就是我的清单的样子:

 apply plugin: 'com.android.application'

android {
compileSdkVersion 22 //changed this, used to be 23
buildToolsVersion "22.0.0" //changed this also, but I don't know if it's installed....

defaultConfig {
    applicationId "xxx"
    minSdkVersion 16
    targetSdkVersion 22
    versionCode 11
    versionName "2.0"
    multiDexEnabled true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
sourceSets { main { java.srcDirs = ['src/main/java', 'libs'] } }
}

repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile('com.twitter.sdk.android:tweet-composer:1.0.2@aar') {
    transitive = true;
}
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:appcompat-v7:22.2.0'//changed this also, but I don't know if it's installed....
compile 'com.android.support:design:22.2.0'//changed this also, but I don't know if it's installed....
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'com.google.android.gms:play-services-identity:8.4.0'
}

所以当我尝试同步时,它给了我这个废话:

C:\Users\jonathan\AndroidStudioProjects\TrashOmeter\app\build\intermediates\res\merged\debug\values-v23\values-v23.xml 错误:(18) 检索项目的父项时出错:找不到与给定名称 'android:Widget.Material.Button.Colored' 匹配的资源。 错误:(3) 检索项目的父项时出错:找不到与给定名称 'android:TextAppearance.Material.Widget.Button.Inverse' 匹配的资源。 Error:Execution 任务“:app:processDebugResources”失败。

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\jonathan\AppData\Local\Android\sdk\build-tools.0.0\aapt.exe'' finished with non-zero exit value 1

如何让它正确地使用 22 sdk 进行编译???

I decided to reduce my api level from 23 to 22

鉴于您 build.gradle 文件中的评论,您似乎是说您将 compileSdkVersion 减少到 22。

我不知道你为什么要那样做。

compileSdkVersion 提高到一个新的水平是完全合理的,并且需要使用一些更新版本的依赖项(更不用说您自己代码中的任何新引用).我知道在现代 Android 开发中没有任何问题可以通过 reducing compileSdkVersion 解决。你似乎在给自己带来痛苦,却没有任何实际好处。

I installed the 22 API now but I don't know if I installed the other stuff like

如果您在 SDK 管理器中有最新的 "Android Repository",那么您有旧版本的 Android 支持库。

//changed this also, but I don't know if it's installed...

如果您在 SDK 管理器中有最新的 "Build Tools",那么您有旧版本的 Android 支持库。

So when I try to sync it gives me this crap:

那 "crap" 是因为您决定将 compileSdkVersion 更改为 22,但没有将您的依赖项更改为类似的旧版本。您当前的依赖版本是参考 API 级别 23(在本例中为资源)中的内容编写的,需要 compileSdkVersion 23。

How do I get it to compile with 22 sdk correctly?

将依赖项的版本减少到 API 级别 23 存在之前的版本。对于那些您从 Maven Central 或 JCenter(例如,facebook-android-sdk)获得的依赖项,您可以从他们的 Web 界面中找出工件的日期,并尝试查找 2015 年 8 月或更早的工件。剩下的......你就靠你自己了。

或者,将您的 compileSdkVersion 改回 23。

感谢 CommonsWare,我找到了答案。我不得不将 google 播放依赖项更改为较低版本。所以在 gradle 我改变了:

发件人:

compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.google.android.gms:play-services-identity:8.4.0'

收件人:

compile 'com.google.android.gms:play-services:7.3.0'
compile 'com.google.android.gms:play-services-identity:7.3.0'

如果您已经在 google play 上上传了您的 apk (sdk 23),您将无法从 SDK 23 降级到 22。商店不会让你。

我已经犯过这个错误,现在我的APP与没有犯这个错误的竞争对手相比处于劣势。

所以不要使用 SDK 23,如果用户必须为您的应用启用 LOCATION(访问 wifi 频道列表是我的应用的主要目的),这会让您的用户生气