0

As I saw the replies from the question(Error:Data Binding does not support Jack builds yet), the data binding is not yet support the JDK8 ( since it required JACK enabled in AS).

However, I saw the data binding usage from the official using the lambdas expression. (https://developer.android.com/topic/libraries/data-binding/index.html#listener_bindings)

Is there any way I can use data binding with JDK 8 since I started to test the App with databinding with API 24(required JDK 8)???

 <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent">
      <Button android:layout_width="wrap_content" android:layout_height="wrap_content"
      android:onClick="@{() -> presenter.onSaveClick(task)}" />
  </LinearLayout>
Community
  • 1
  • 1
Long Ranger
  • 5,888
  • 8
  • 43
  • 72
  • Why do you need data binding for that? Can't you just do `android:onClick="onSaveClick"`? – OneCricketeer Aug 11 '16 at 02:29
  • I started to develop the app with API 23 using the data binding with this syntax. Now I want to migrate the current code using lambdas expression( A lot of Rx in my app) , but it does not work ( u know, data binding is not supported to JACK yet) – Long Ranger Aug 11 '16 at 02:38
  • It's not entirely clear that the lambdas in the databinding require the Jack compiler. It only says that Gradle 1.5.0-alpha1 or higher is required – OneCricketeer Aug 11 '16 at 03:04

1 Answers1

1

Yes there is no support for Jack Build yet, but you can use lambda expressions in XMl files.

As the update from yigit https://code.google.com/p/android/issues/detail?id=210615#c11

These issues do not affect all apps and are not specific to data binding (any annotation processor can hit them). We'll release an experimental integration in 2.3 and also working on fixing those issues.

Still if you want to use lambda with Data Binding, you can use it. But if you want other features in java, you cannot.

Ravi
  • 34,851
  • 21
  • 122
  • 183