Android Studio fails to generate databinding after 3.1.0 update

前端 未结 20 2920
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-15 02:40

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

20条回答
  •  爱一瞬间的悲伤
    2020-12-15 03:31

    You need to change three things when you update from Android Studio 3.0.1 to 3.1.0. This is as listed below

    1) You need to change in gradle.wrapper-properties in distributionUrl. Your URL must be distributionUrl=https://services.gradle.org/distributions/gradle-4.4-all.zip

    To

    2) Need to update data binding dependancy in app level gradle file from kapt 'com.android.databinding:compiler:3.0.1' to kapt 'com.android.databinding:compiler:3.1.0'

    And if you are develop using kotlin then,

    3) Third and last thing is need to update kotlin gradle plug in classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.30" to classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.31" in project level gradle dependancy. Also you can update build gradle version as seen in below image.

    after all above step just clean build and rebuild project. Hope it will work to solve your problem.

    Thanks!! Happy coding!!

提交回复
热议问题