无法解析时支持库版本更改符号 [英] Cannot resolve symbol upon support library version change

查看:398
本文介绍了无法解析时支持库版本更改符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望有人可以阐明这个问题的一些情况。我试图从改变支持库版本:

 编译com.android.support:support-annotations:23.1.0
编译com.android.support:support-v4:23.1.0
编译com.android.support:support-v13:23.1.0
编译com.android.support:appcompat-v7:23.1.0
编译com.android.support:design:23.1.0
编译com.android.support:cardview-v7:23.1.0
编译com.android.support:recyclerview-v7:23.1.0

 编译com.android.support:support-annotations:23.1.1
编译com.android.support:support-v4:23.1.1
编译com.android.support:support-v13:23.1.1
编译com.android.support:appcompat-v7:23.1.1
编译com.android.support:design:23.1.1
编译com.android.support:cardview-v7:23.1.1
编译com.android.support:recyclerview-v7:23.1.1

通常看起来是什么样的一个简单的小幅升级已经引起了我整整一天。基本上在更新gradle.build文件,我同步 - >干净,然后就会出现一堆无法解析出现在IDE的类从支持库符号错误

什么是进一步有趣的是,如果我尝试我的手机上通过亚行,运行code,尽管AS显示为无法解析符号,它运行在手机上完全正常的。

在我尝试过的事情:


  1. 清洁/重建

  2. 无效缓存/重启

  3. 删除所有.iml文件和文件夹.idea

  4. Android的工作室重新安装,重新导入项目

  5. 重新启动

进一步挖掘到build目录,他们是在这个意义上相似,无论

打造\\ \\中间体爆炸-AAR \\ com.android.support \\应用程序兼容性-V7 \\ 23.1.0 \\罐\\ classes.jar

打造\\ \\中间体爆炸-AAR \\ com.android.support \\应用程序兼容性-V7 \\ 23.1.1 \\罐\\ classes.jar

分别产生的。所不同的是,在AS,为previous版本中,classes.jar可以开设了AS作为哪里与新版本,他们不能在AS打开

我觉得我有pretty多少用尽所有可用的选项,因此,如果任何人都可以阐明如何解决这个有一些启发,我真的太多AP preciate它。

我的全gradle.build文件:

 应用插件:'com.android.application安卓{
    compileSdkVersion 23
    buildToolsVersion23.0.2    defaultConfig {
        的applicationIDcom.XXX
        15的minSdkVersion
        targetSdkVersion 23
        版本code 1
        的versionName1.1.1
        multiDexEnabled真
    }
    buildTypes {
        发布 {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard的-android.txt'),'proguard-rules.pro
        }
    }}依赖{
    编译文件树(导演:'库',包括:['的* .jar'])
    编制项目(路径:':XXX,配置:Android的终端)
    testCompile'的JUnit:JUnit的:4.12
    编译com.google code.gson:GSON:2.4
    编译org.apache.commons:公地lang3:3.4
    编译com.balysv:材料纹波:1.0.2
    编译net.sf.flexjson:flexjson:3.3
    编译com.jakewharton:奶油刀:7.0.1
    编译com.google.android.gms:播放服务的广告:8.1.0
    编译com.google.android.gms:播放服务身份:8.1.0
    编译com.google.android.gms:播放服务-GCM:8.1.0
    编译com.android.support:support-annotations:23.1.0
    编译com.android.support:support-v4:23.1.0
    编译com.android.support:support-v13:23.1.0
    编译com.android.support:appcompat-v7:23.1.0
    编译com.android.support:design:23.1.0
    编译com.android.support:cardview-v7:23.1.0
    编译com.android.support:recyclerview-v7:23.1.0
}


解决方案

我觉得我已经解决了这个问题的家伙。进入主模块在你的项目,它通常是有名字的应用

然后去> 打开模块设置>中的属性修改生成工具版本 23.0.1

然后确保打开的build.gradle 文件,并更改compileSDKVersion&安培; buildToolsVersion分别为23和23.0.1。

 安卓{
compileSdkVersion 23
buildToolsVersion '23 .0.1defaultConfig {
    的applicationIDid.web.twoh
    15的minSdkVersion
    targetSdkVersion 21
    版本code 1
    的versionName1.0
}
buildTypes {
    发布 {
        minifyEnabled假
        proguardFiles getDefaultProguardFile('proguard的-android.txt'),'proguard-rules.pro
    }
  }
}

您还应该确保项目中的所有模块都具有compileSdkVersion和buildToolsVersion开始的 23 ,因为你将使用支持库的版本23日

I'm hoping someone might shed some light on this issue. I am trying to change the support library versions from:

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'

to

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'

What usually seems like a simple minor upgrade has caused me the entire day. Basically upon updating the gradle.build file, I sync -> clean, and there appears a bunch of Cannot Resolve Symbol errors appearing on the IDE for classes from the support library.

What's further interesting about this is that if I try to run the code on my phone through adb, despite AS showing up as "Cannot resolve symbol", it runs perfectly fine on my phone.

Among the things I've tried:

  1. Clean / Rebuild
  2. Invalidate cache / restart
  3. Delete all the .iml files and the .idea folder
  4. Reinstalling of Android Studio, reimport of project
  5. Rebooting

Digging further into the build directory, they are similar in the sense that both

build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.1.0\jars\classes.jar

and

build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.1.1\jars\classes.jar

were generated respectively. What's different is that in AS, for the previous version, the "classes.jar" can be opened in AS where as with the new version, they cannot be opened in AS.

I feel that I have pretty much exhausted all available options so if anyone can shed some light on how to resolve this, I would really much appreciate it.

My full gradle.build file:

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'
}

解决方案

I think I have solved this problem guys. Go to the main module in your project, it's usually have the name app.

Then go to > Open Module Settings > in Properties change the Build Tools Version to 23.0.1.

Then to make sure open the build.gradle file, and change compileSDKVersion & buildToolsVersion to 23 and 23.0.1 respectively.

android {
compileSdkVersion 23
buildToolsVersion '23.0.1'

defaultConfig {
    applicationId "id.web.twoh"
    minSdkVersion 15
    targetSdkVersion 21
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
  }
}

You should also make sure that all modules in your project have the compileSdkVersion and buildToolsVersion begin with 23, as you will use the 23th version of the support library.

这篇关于无法解析时支持库版本更改符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆