Reputation: 667
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…
Upvotes: 4
Views: 3901
Reputation: 667
First, thanks for all your support !
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.
I updated my Android Studio to match the plugin and now it is working !
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")
Upvotes: 3
Reputation: 8200
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
Upvotes: 4
Reputation: 43
In my case R.java always generates in build\generated\not_namespaced_r_class_sources
. You can try cleaning and rebuilding the product.
Upvotes: 3