cmelchior / realmfieldnameshelper

Realm extension library used to create more type-safe queries.
Apache License 2.0
173 stars 21 forks source link

"Cannot resolve symbol xxxFields" #24

Closed gmkado closed 6 years ago

gmkado commented 7 years ago

Hi @cmelchior hoping you can help me with an issue. I was using this library and it was working fine, but I recently tried to update my realm plugin to 3.7.1. Unrelatedly this broke my ability to use stetho-realm and I reverted back. In the process I did a lot of gradle fiddling and now my code is in a weird state where Android Studio doesn't recognize the "xxxFields" generated files that your library produces. It still builds fine but can't autocomplete anymore and I suspect won't update if I change the realm models.

I know this is vague, I'm not really sure how I got here. Do you know how to get this back to a working state? I tried "gradlew cleanBuildCache" and "invalidate Caches/Restart" with no luck.

Gounlaf commented 7 years ago

Are you using Android Studio 2 or 3 ? Does your project still build or not ?

With Android Studio 3 Beta (not alpha), I got theses kind of error:

Execution failed for task ':mymodule:compileDebugJavaWithJavac'.
> java.lang.ClassNotFoundException: my.realm.ClassExtendingRealmObject

It's related to how gradle build the project.

What you can do, temporary, is to recreate manually your xxxFields classes

cmelchior commented 7 years ago

@gmkado That sounds mostly like a caching problem. When those happens I try to use this list :)

./gradlew clean
./gradlew --stop
rm -r .gradle
Restart Android Studio
Invalidate caches
Restart computer
Each one includes executing the previous ones in reverse order

Gradle can be painful sometimes 😞

gmkado commented 7 years ago

Thanks for the suggestions! I'm sing Android Studio 2.3.3 and I managed to get it working again by adding apply plugin "idea" to my build.gradle and rebuilding (after reading this https://github.com/tbroyer/gradle-apt-plugin/issues/26)

Drjacky commented 6 years ago

@gmkado Thank you for the solution. So please close the issue :-)