Search code examples
dependenciesandroid-support-librarywear-osandroidxmigrate

Migrate to AndroidX for Wear Support Libraries after Android Pie?


Starting in Fall of 2019 the Google Play Console requires your wearable application targets at least Android 9 (API level 28).

  • August 1, 2019: Required for new apps
  • November 1, 2019: Required for app updates

After changing my build.gradle to target 29 it gives me a warning recommending I use AndroidX libraries when targeting Android Q or newer.

What should I change the com.android.support dependencies to?

implementation 'com.android.support:wear:28.0.0'
implementation 'com.android.support:support-compat:28.0.0'

Solution

  • Changing to the following solved the issue for me.

    implementation 'androidx.wear:wear:1.0.0’
    implementation 'androidx.core:core:1.1.0’
    implementation 'androidx.core:core-ktx:1.1.0’ // if you are using Kotlin
    

    Also, if you right click > Refactor > Migrate to AndroidX… Android Studio will take care of the necessary migrations for you.