我希望有人可以阐明这个问题。我正在尝试更改支持库版本:
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”可以是opened。在 AS 中,与新版本一样,他们 cannot be opened在 AS 中。
我觉得我已经用尽了所有可用的选项,所以如果有人能阐明如何解决这个问题,我将非常感激。
我的完整 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'
}
最佳答案
我终于解决了:
首先,我更新了gradle插件。
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
然后只需 Build->Clean project,一切都将再次运行。
关于android - 支持库版本更改时无法解析符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33702031/