13

I am implementing DataBinding, it is working perfect, but it is not allowing me to use jackOptions. It throws error Data Binding does not support Jack builds yet while build.

Here is my build.gradle

android {


   defaultConfig {
       ...

       dataBinding {
           enabled true
       }

       jackOptions {
           enabled true
       }
   }

   compileOptions {
       sourceCompatibility JavaVersion.VERSION_1_8
       targetCompatibility JavaVersion.VERSION_1_8
   }
}
Ravi
  • 34,851
  • 21
  • 122
  • 183

3 Answers3

9

From yigit's comment it's clear that this functionality is still under development as he and George are project member of DataBinding.

we are working on it... yigit

I have also found that issue is already reported Issue 210615: Databinding with Jack compiler

UPDATE

2.3 will allow you to use data binding with jack but it still has limitations

Community
  • 1
  • 1
Ravi
  • 34,851
  • 21
  • 122
  • 183
2

Google will add support for Java 8 language features directly into the current javac and dx set of tools, and deprecate the Jack toolchain.

Check this out , Future of Java 8 Language Feature Support on Android

https://android-developers.googleblog.com/2017/03/future-of-java-8-language-feature.html

Updates:

Java 8 language features are now supported by the Android build system

Yesterday, we released Android Studio 2.4 Preview 6. Java 8 language features are now supported by the Android build system in the javac/dx compilation path. Android Studio's Gradle plugin now desugars Java 8 class files to Java 7-compatible class files, so you can use lambdas, method references and other features of Java 8.

Source : https://android-developers.googleblog.com/2017/04/java-8-language-features-support-update.html

Oussaki
  • 1,449
  • 2
  • 21
  • 30
  • 1
    Thanks for sharing, this is very useful. – Autumn Mar 16 '17 at 21:29
  • Ok, but preview Android Studio builds are too risky for use for production projects. We need to wait for 2.4 stable. BTW Jack is sometimes extremely slow, compilation takes ages – user1209216 Jul 10 '17 at 12:28
0

As of gradle:2.2.0-alpha5, Jack builds are not yet compatible with DataBinding.

If you want to use data binding with Java 8, you can use retrolambda.