在Android Studio中更新到Gradle 3.3.2时出错:无法解析符号R [英] Error when updating to Gradle 3.3.2 in Android Studio: Cannot resolve symbol R
问题描述
如果我通过更改来更新Gradle
If I update Gradle by changing
dependencies {
classpath 'com.android.tools.build:gradle:3.x.x'
}
从版本 3.2.1 到版本 3.3.2 ,我在所有活动中均收到Cannot resolve symbol R
错误,但但错误.不知道是什么原因造成的.我在项目文件的Android视图上意识到,在app/generatedJava/
下有许多版本为 3.2.1 的软件包,但是更新时,除了my.app.package
.
from version 3.2.1 to version 3.3.2 I get the Cannot resolve symbol R
error on all activities but the project actually builds without errors. Don't know what might be causing this. I realized on the Android view of the project files, under app/generatedJava/
there are many packages with version 3.2.1, but when updated none of them are there, except for a BuildConfig.java
class under my.app.package
.
我已经尝试了所有 Build-> Clean , Build-> Rebuild , File-> Invalidate caches , File->与Gradle文件同步项目等方法可以解决问题,但仍然找不到R类.
I've already tried all the Build -> Clean, Build -> Rebuild, File -> Invalidate caches, File -> Sync Project with Gradle Files, etc. methods which would solve the problem and still not finding the R class.
对于版本 3.2.1 ,这不会发生.
With version 3.2.1 this doesn't happen though.
推荐答案
正如Vivek在评论中所述,解决方案也是升级Android Studio.我升级到版本 3.3
,它终于解决了问题对我来说.
As Vivek stated in the comments, the solution is to upgrade Android Studio as well. I upgraded to version 3.3
and it finally solved the problem for me.
这篇关于在Android Studio中更新到Gradle 3.3.2时出错:无法解析符号R的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!