【发布时间】:2016-01-25 18:35:33
【问题描述】:
我希望有人能对这个问题有所了解。我正在尝试从以下位置更改支持库版本:
compile 'com.android.support:support-annotations:23.1.0'
compile 'com.android.support:support-v4:23.1.0'
compile 'com.android.support:support-v13:23.1.0'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.android.support:cardview-v7:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
到
compile 'com.android.support:support-annotations:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:support-v13:23.1.1'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
通常看起来像一个简单的小升级已经让我整天忙活。基本上在更新 gradle.build 文件时,我同步 -> 清理,并且在 IDE 上出现了一堆无法解析符号错误,用于支持库中的类。
更有趣的是,如果我尝试通过 adb 在手机上运行代码,尽管 AS 显示为“无法解析符号”,但它在我的手机上运行良好。
在我尝试过的事情中:
- 清理/重建
- 使缓存无效/重新启动
- 删除所有 .iml 文件和 .idea 文件夹
- 重新安装 Android Studio,重新导入项目
- 正在重新启动
深入研究构建目录,它们在某种意义上是相似的
build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.1.0\jars\classes.jar
和
build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.1.1\jars\classes.jar
分别生成。不同的是,在AS中,对于之前的版本,“classes.jar”在AS中可以是opened,而在新版本中,它们在AS中是cannot be opened。
我觉得我已经用尽了所有可用的选项,所以如果有人能阐明如何解决这个问题,我将不胜感激。
我的完整 gradle.build 文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.XXX"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.1.1"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(path: ':XXX', configuration: 'android-endpoints')
testCompile 'junit:junit:4.12'
compile 'com.google.code.gson:gson:2.4'
compile 'org.apache.commons:commons-lang3:3.4'
compile 'com.balysv:material-ripple:1.0.2'
compile 'net.sf.flexjson:flexjson:3.3'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.google.android.gms:play-services-ads:8.1.0'
compile 'com.google.android.gms:play-services-identity:8.1.0'
compile 'com.google.android.gms:play-services-gcm:8.1.0'
compile 'com.android.support:support-annotations:23.1.0'
compile 'com.android.support:support-v4:23.1.0'
compile 'com.android.support:support-v13:23.1.0'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.android.support:cardview-v7:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
}
【问题讨论】:
-
可能是个愚蠢的问题,但是您的 sdk 管理器中的 Android 支持存储库是最新的吗?
-
哈哈,你赢了我几秒钟!
-
我在 build.gradle 中从 23.1.0 升级到 23.1.1 后遇到了同样的问题
-
我也是。但真正让我感到沮丧的是谷歌删除课程的速度有多快。向后兼容性会发生什么?
标签: android android-studio android-support-library