2

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?

localhost
  • 5,568
  • 1
  • 33
  • 53
mars3142
  • 2,501
  • 4
  • 28
  • 58

3 Answers3

2

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.
localhost
  • 5,568
  • 1
  • 33
  • 53
0

A possible workaround is to use retrolambda if you're using Jack to use Java 8 features like lambdas.

fhucho
  • 34,062
  • 40
  • 136
  • 186
0

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.

空気嫁
  • 186
  • 5