Compiling Realm project with Jack compiler

谁说胖子不能爱 提交于 2019-12-11 00:52:47

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!