我决定将api级别从23降低到22.首先,我下载了安装了最新23 API的android studio。我现在安装了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:\用户\乔纳森\ AndroidStudioProjects \ TrashOmeter \应用\构建\中间体\ RES \合并\调试\值-V23 \值-v23.xml 错误:(18)检索项目的父项时出错:找不到与给定名称匹配的资源' android:Widget.Material.Button.Colored'。 错误:(3)检索项目的父项时出错:找不到与给定名称匹配的资源' android:TextAppearance.Material.Widget.Button.Inverse'。 错误:任务':app:processDebugResources'执行失败。
com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:进程'命令' C:\ Users \ jonathan \ AppData \ Local \ Android \ sdk \构建工具\ 22.0.0 \ aapt.exe''完成非零退出值1
如何正确编译22 sdk ???
答案 0 :(得分:6)
如果已经在google play上传了你的apk(sdk 23),你将无法从SDK 23降级到22。商店不会让你。
我已经犯过这个错误,现在我的APP与我没有犯过这个错误的竞争对手相比处于不利地位。
所以不要使用SDK 23,它会让你的用户生气,如果他们必须为你的应用启用LOCATION(访问wifi频道列表是我的应用程序的主要目的)
答案 1 :(得分:1)
我决定将api级别从23降低到22
根据您build.gradle
文件中的评论,您似乎意味着将compileSdkVersion
缩减为22。
我不知道你为什么会这样做。
将compileSdkVersion
提升到更新的级别是完全合理的,并且需要使用一些较新版本的依赖项(更不用说来自您自己的代码的任何新引用)。我知道现代Android开发中没有问题可以通过 reduce compileSdkVersion
来解决。你似乎在为自己带来痛苦而没有实际的好处。
我现在安装了22 API,但我不知道是否安装了其他类似
的东西
如果您在SDK管理器中拥有最新的“Android Repository”,那么您将拥有旧版本的Android支持库。
//也改变了这个,但我不知道它是否已经安装......
如果您在SDK Manager中拥有最新的“构建工具”,那么您将拥有旧版本的Android支持库。
因此,当我尝试同步时,它给了我这个废话:
“垃圾”是因为您决定将compileSdkVersion
更改为22,但不会将您的依赖项更改为类似的旧版本。您当前的依赖项版本是使用API Level 23(在本例中为资源)中的内容编写的,需要compileSdkVersion
23。
如何正确编译22 sdk?
将依赖项的版本减少为API级别23之前存在的版本。对于那些从Maven Central或JCenter获得的版本(例如facebook-android-sdk
),您可以找到日期来自其Web界面的工件,并尝试从2015年8月或更早的时候找到它们。其余的......你是独自一人。
或者,将compileSdkVersion
更改回23。
答案 2 :(得分:1)
感谢CommonsWare,我找到了答案。我不得不将google play依赖项更改为较低版本。所以在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'