android - 支持库版本更改时无法解析符号

标签 android android-studio android-support-library

我希望有人可以阐明这个问题。我正在尝试更改支持库版本:

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 显示为“无法解析符号”,它在我的手机上运行得很好。

在我尝试过的事情中:

  1. 清理/重建
  2. 使缓存无效/重启
  3. 删除所有.iml 文件和.idea 文件夹
  4. 重新安装 Android Studio,重新导入项目
  5. 重新启动

进一步深入构建目录,它们在某种意义上是相似的

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/

相关文章:

java - Lua 在 Android 上是否与 Java 一样强大,或者有什么限制?

Android Studio 和 NDK 集成问题

android-studio - 如何在 Android Studio 中创建不同的文件夹来组织源代码?

android - 在自定义 DialogPreference 中使用支持库 v4 fragment

android - 升级到 AppCompat v22.1.0 现在按下菜单键时不会触发 onKeyDown 和 onKeyUp

android - OSX Lion 上的 adb,但无法连接到 galaxy 10.1 选项卡,但在 linux 中运行良好

android如何获取要调用的紧急电话号码

android - 抽屉导航在没有数据网络 android 时不会打开

java - 有没有办法在Android的Action Bar中应用过滤器

android - BottomSheetDialogFragment 为深色主题设置了错误的背景颜色