Andorid Studio找不到R类
When Andorid Studio report error that cannot reslove R
, you can try following method to solve it.
-
Rebuild the project or resyc the Gradle.
-
It might because of the size of R file is out of the maximum size of single file. You can change it via your Android Studio IDE. Click
Help -> Edit Custom Properties
at idea.properties
file, add a extra line/or change existing setting:
idea.max.intellisense.filesize = 20000
Notice: the default size is 2500, you can change whatever parameter you like just ensure it is larger than R file. This is configuration for your Andorid Studio IDE and saved locally, therefore, you might need to reconfigure it when you change your IDE; moving your project; update/upgrade Android Studio.
当Android Studio 提示找不到R类时,可以尝试一下方法:
- 尝试rebuild项目和重新同步Gradle
- 可能由于R文件的大小大于Android Studio设定的最大文件大小。因此可以在Android Studio界面下:
Help -> Edit Custom Properties
在出现的idea.properties
文件中加入/修改一行:
idea.max.intellisense.filesize = 20000
其中2000
参数可以为任意int但是要确保大小比R文件大。默认值为2500。这个配置是Android Studio的配置,并保存在本地。因此您可能需要重新配置这个当您跟换了开发环境或升级了Android Studio。
Enjoy coding!