Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R.java not found on Android Studio 3.2

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.

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

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 ?

Thanks folks!

Edit : I was actually using Android Studio 3.2…

like image 496
Sylfo Avatar asked Dec 24 '22 01:12

Sylfo


2 Answers

In my case, I have to revert the version of android build tool:

classpath 'com.android.tools.build:gradle:3.2.1' // use this version instead of 3.3.0
like image 158
Kingfisher Phuoc Avatar answered Dec 26 '22 00:12

Kingfisher Phuoc


In my case R.java always generates in build\generated\not_namespaced_r_class_sources . You can try cleaning and rebuilding the product.

like image 39
Ripunjoy Das Avatar answered Dec 25 '22 22:12

Ripunjoy Das