I'm migrating my dependencies for an Android P test to the androidx dependencies. For some not very clear reasons my project does not compile anymore (and no I won't provide the details to avoid a distinct problem). I found out (via gradlew dependencies
) that the databinding uses the "oldschool" dependency android.arch.lifecycle:runtime:1.0.3
instead of androidx.lifecycle:lifecycle-runtime:2.0.0-beta01
. I guess that could be one reason.
Any idea how to force using the new package names/dependencies?
View binding and data binding both generate binding classes that you can use to reference views directly. However, view binding is intended to handle simpler use cases and provides the following benefits over data binding: Faster compilation: View binding requires no annotation processing, so compile times are faster.
Data Binding allows you to effortlessly communicate across views and data sources. This pattern is important for many Android designs, including model view ViewModel (MVVM), which is currently one of the most common Android architecture patterns.
Data Binding Library Part of Android Jetpack. Stay organized with collections Save and categorize content based on your preferences. The Data Binding Library is a support library that allows you to bind UI components in your layouts to data sources in your app using a declarative format rather than programmatically.
Recently Android has announced that with Kotlin 1.4. 20, their Android Kotlin Extensions Gradle plugin will be deprecated and will no longer be shipped in the future Kotlin releases. Android Kotlin Extensions plugin brought with it two very cool features : Synthetics let you replace calls to findViewById with kotlinx.
I face the similar problem, the Data Binding
library use the support library, some classes may conflict with the AndroidX
. I have to remove the DataBinding
for now.
I just read this release note, it said that this issue had been fixed, but I didn't see the effect.
Enabling AndroidX in the gradle.properties
fixed this problem for me:
android.useAndroidX=true
android.enableJetifier=true
See https://developer.android.com/jetpack/androidx#using_androidx:
android.useAndroidX
: When set to true, the Android plugin uses the appropriate AndroidX library instead of a Support Library. The flag is false by default if it is not specified.android.enableJetifier
: When set to true, the Android plugin automatically migrates existing third-party libraries to use AndroidX by rewriting their binaries. The flag is false by default if it is not specified.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With