Search code examples
androidandroid-support-libraryandroid-libraryandroidx

Compatibility between Library in AppCompat/Support 26.1.0 and AndroidX


My company develops a library for Android. Currently we have a live version with:

    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support:support-v4:26.1.0'
    implementation 'com.android.support:support-core-utils:26.1.0'

and a development version with

    implementation "com.android.support:cardview-v7:28.0.0"
    implementation "com.android.support:appcompat-v7:28.0.0"
    implementation "com.android.support:support-core-utils:28.0.0"
    implementation "com.android.support:support-compat:28.0.0"
    implementation "com.android.support:support-fragment:28.0.0"
    implementation "com.android.support:design:28.0.0"

On our test apps we couldn't find any issues, but they use '26.1.0' on their implementation. Also, I've searched for info on Android's portal, but they don't have much information on Library development, all I could find about migrating to androidX is relating to App developers.

My questions are:

Will there be any issues regarding compatibility with our client's apps when pushing the 28.0.0 update?

Is it worth it migrating the whole library to AndroidX?

Will it break compatibility with apps running AppCompat/Support?


Solution

  • AndroidX replaces the original support library APIs with packages in the androidx namespace. Only the package and Maven artifact names changed; class, method, and field names did not change.

    Generally, you can expect the following mapping from old to new packages:

    Old                         New
    android.support.**          androidx.@
    android.databinding.**      androidx.databinding.@
    android.design.**           com.google.android.material.@
    

    The Architecture Components libraries have also been moved under androidx and their package names simplified to reflect their integration with core libraries.

    Note: We recommend working in a separate branch when migrating. Also try to avoid refactoring your code while performing the migration.

    Read AndroidX Overview and Migrating to AndroidX.