问题
How can I use realm.io with Java 1.8?
For Android with Java 1.8 you need to use jack. The combination of the Android realm gradle plugin and jack seems not to work. Because after I added
apply plugin: 'realm-android'
to my app.gradle file, I get
* What went wrong:
A problem occurred configuring project ':app'.
> Could not find property 'options' on task ':app:compileProdDebugJavaWithJack'.
Does someone know how to get work it together? Why isn't there a normal dependency?
回答1:
At the moment that's not possible. Jack doesn't produce .class files which are required for Realm to deal with proxy classes.
But people work on this so in future that might be possible. Track these issues for details:
- Realm issue on Github.
- Jack issue on b.google.com.
回答2:
A possible workaround is to use retrolambda if you're using Jack to use Java 8 features like lambdas.
回答3:
Another workaround. Right now in my company's project, we extract realm to another module and setup realm there, then open jack in 'app' module is fine.
来源:https://stackoverflow.com/questions/36746452/compiling-realm-project-with-jack-compiler