Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

This morning I made an update to android studio from 3.0.1 to 3.1.0. After updating the gradle to latest version I still get build error regarding data binding.

My gradle-wrapper.properties:

distributionUrl=https://services.gradle.org/distributions/gradle-4.4-all.zip

All my errors are like the one below:

/Users/mp/Documents/GitHub/projectx/app/build/generated/source/dataBinding/baseClasses/Staging/debug/me/projectx/asdasd/databinding/GridItemActivityTypeBinding.java:57: error: cannot find symbol
      @Nullable DataBindingComponent component) {
                ^
  symbol:   class DataBindingComponent
  location: class GridItemActivityTypeBinding

Does anyone have any idea why would my data binding not generate after the android studio 3.1 update? Thanks in advance

Edit 1: Forgot to say, I tried clean/rebuild/invalidate cache & restart/deleted build folder.

question from:https://stackoverflow.com/questions/49514488/android-studio-fails-to-generate-databinding-after-3-1-0-update

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
238 views
Welcome To Ask or Share your Answers For Others

1 Answer

Following the update to Android Studio 3.2, this line works for me. I have both Java and Kotlin code (compiler) running in my project.

Add the following to your gradle.properties: android.databinding.enableV2=false

Reason:

Data Binding V2

Data Binding V2 is now enabled by default and is compatible with V1. This means that, if you have library dependencies that you compiled with V1, you can use them with projects using Data Binding V2. However, note that projects using V1 cannot consume dependencies that were compiled with V2.

source (Release Note): https://developer.android.com/studio/releases/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...