Gradle Cannot Resolve Generated Classes
I was using Data Binding in my android project and it was working flawlessly until yesterday. I don't know what had happened but now cannot compile my project any more:
error: cannot find symbol class BR
The interesting part is, the Data Binding related classes are generated as expected, I can navigate into
BR and view all variables there.
The generated sources are at
build/generated/source/apt/debug location. Android Studio also displays
generatedJava folder, including the
BR class, as follows:
iml file contains an entry as follows:
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8"> ... <content url="file://$MODULE_DIR$"> ... <sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/debug" isTestSource="false" generated="true" /> ... </content> </component>
Everything seems to be quite normal. I restarted AS, invalidated cache, deleted
.gradle folder in project, cleared
.gradle/caches in home folder, but no luck!
Clean Project, the editor shows data binding related classes (including
BR) in red, which is as expected. After I
Rebuild Project, it gives me this compilation error but these classes are now resolved and I can navigate into them with Cmd + click. After they have been resolved, I try rebuild, make etc. but it always gives me the same compilation error.
I have spent hours on this silly problem, any kind of help is highly appreciated.
PS: The problem seems very similar with this one, but it's very old (i.e. gradle and the plugins are not up to date) and also in comments it is stated that data binding classes are OK.
The build window was showing a single error, the one that I have included in question. From terminal, I tried
./gradlew :app:build and it gave me another error, as follows:
Not sure how to handle insert method's return type.
I had added a method to a
Room but the return type was not suitable. That was a mistake. After I fixed that, the other error has gone.
- → should I choose reactjs+f7 or f7+vue.js?
- → Phonegap Android write to sd card
- → Local reference jquery script in nanohttpd (Android)
- → Click to navigate on mobile devices
- → How to allow api access to android or ios app only(laravel)?
- → Access the Camera and CameraRoll on Android using React Native?
- → React native change listening port
- → What is the default unit of style in React Native?
- → Google play market autocomplete icon
- → Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `ListView`
- → Using Laravel with Genymotion
- → react native using like web-based ajax function
- → react native pdf View