Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Undo migration to AndroidX

Tags:

I've refactored my Android Studio codebase to AndroidX successfully. But it is causing a few problems with some of my libraries.

I need to revert it since the app is going into production soon. How can I do it?

like image 963
AnupamChugh Avatar asked Nov 23 '18 12:11

AnupamChugh


People also ask

Is it good to migrate to AndroidX?

So, if you want bug fixes or new features that would have previously gone into the Support Library, you need to migrate to AndroidX. Better package management. With AndroidX, you get standardized and independent versioning, as well as better standardized naming and more frequent releases.

What does migrate to AndroidX?

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. Caution: As of late 2021, most of the library ecosystem already supports AndroidX natively.

Why we need to migrate to AndroidX?

The android support library will be never maintained by Google under the support library namespace. So if you want to find fixes of a bug in support library you must have to migrate your project in AndroidX. Google play services, Firebase, Mockito 2, etc are already have migrated to AndroidX.


1 Answers

I had gone through the same, Follow the steps to undo the AndroidX Migration:

  1. Remove following lines in gradle.properties:

    android.enableJetifier=true
    android.useAndroidX=true
    
  2. Remove AndroidX dependencies in build.gradle of your app and replace them with their equivalent Non AndroidX dependencies:

    e.g.

    implementation 'androidx.core:core:1.0.0-beta01'
    implementation 'androidx.appcompat:appcompat:1.0.0-beta01'
    
  3. Sync Project with Gradle Files

  4. After syncing you may have import errors in java files, you can remove the androidx imports and re add the equivalent non androidx imports

I hope it will help everyone facing migration rollback problem. If you get any conflict issues while performing above steps in Android Studio, try to clean and rebuild the project.

like image 54
zeeali Avatar answered Sep 29 '22 08:09

zeeali