在Android Studio 3.2上找不到R.java [英] R.java not found on Android Studio 3.2

查看:391
本文介绍了在Android Studio 3.2上找不到R.java的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们继承的Android项目中,我们有一个奇怪的行为. APK 构建没有错误,但是 IDE一直在抱怨导入中缺少R类.

We've got a strange behaviour in an Android project we inherited. The APK builds without error but the IDE keeps complaining about missing R class in imports.

我们正在使用Android Studio 3.3. (错误!请参见底部的编辑)

We are using Android Studio 3.3. (wrong ! see edit at bottom)

经过进一步的挖掘,我们发现R.java文件实际上是在build\generated\not_namespaced_r_class_sources中而不是通常的build\generated\sources中生成的.

After a little more digging, we found that the R.java file is actually generated but in build\generated\not_namespaced_r_class_sources rather than the usual build\generated\sources.

有人有这个吗?更好的是,有人知道如何解决此问题吗?

Does anyone already got this ? Even better, does anyone know how to fix this ?

谢谢大家!

我实际上是在使用Android Studio 3.2…

推荐答案

首先,感谢您的支持!

阅读@Kingfisher Phuoc响应后,我终于发现这是我的 Android Studio 3.2 与使用 Android gradle插件3.3 之间的不兼容

After reading @Kingfisher Phuoc response, I finally found that it was an incompatibility between my Android Studio 3.2 and using Android gradle plugin 3.3.

更新了我的Android Studio以匹配该插件,现在它正在工作

R类的生成方式似乎已在3.3版本中进行了更新(来源:发行说明,请查找为图书馆项目快速生成R类" )

It looks like the way the R class is generated have been updated in the 3.3 version (source: release notes, look for "Faster R class generation for library projects")

这篇关于在Android Studio 3.2上找不到R.java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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