realm-java: Annotation processing problem with Android Studio
Issue
I’ve got a really annoying problem with Realm and Android Studio. About every third time I compile my project I get the following exception:
java.lang.RuntimeException: Unable to create application com.example.MyApp: io.realm.exceptions.RealmException: class com.example.MyApp.model.MyObject is not part of the schema for this Realm.
I understand that this is due to the annotation processor not correctly doing its thing. So currently each time I get the error, I run a full clean/rebuild and then it’s working fine. But that is a bit of a pain. How can I fix it so that I do not have to clean/rebuild all the time?
This issue actually started appearing just recently and on both of the development machines that I’m using. A few weeks ago it never has happened.
In Android Studio I have “Enable annoation processing” enabled under “Default Preferences” > “Build, Execution, Deployment” > “Compiler” > “Annotation Processors”.
Any idea what could be missing?
Version of Realm and tooling
Realm version(s): 0.87.2 Android Studio version: 1.5.1
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 1
- Comments: 48 (25 by maintainers)
I’ve updated the Gradle plugin from 1.5.0 to 2.1.0 a while ago and for now it seems to have solved the issue… but let’s wait a day or two to really be sure. It looks primising though 😃
Yes, I’m having four different flavours. They each only define just one class with a few
public static final String
variables.I’m using Gradle 2.10. It was 2.08 before but then I was promoted to upgrade to 2.10 by some component. It could be that this problem started appearing after the Gradle 2.10 upgrade actually.
Ok, I’ll send you one working and one not working model class.