Asfos22
Asfos22

Reputation: 319

How to migrate flutter project to androidx

How to migrate existing flutter project to Android X ? Are there any pro and cons?

Upvotes: 8

Views: 13035

Answers (4)

Clean_Coder
Clean_Coder

Reputation: 31

In my case, I can not see the gradle.properties file under the android path. So, create new gradle.properties and adding the following lines of code inside it has solved the problem

android.useAndroidX=true android.enableJetifier=true

The next thing I do is adding the following androidx enabler code to the pubspec.yaml file

module: androidx: true

Note: It is recommended to perform the clean and get operations before and after making the changes to your project.

Regards.

Upvotes: 0

Quving
Quving

Reputation: 41

I did the same mentioned what has been mentioned by the last two answers. (Refactor -> Migrate to AndroidX ...) but it didn't help really. I still got the error by flutter that it's not a AndroidX project.

I fixed it by adding;

android.enableJetifier=true
android.useAndroidX=true

to android/gradle.properties

Note, there are one in root and the other in android-directory.

Upvotes: 4

CopsOnRoad
CopsOnRoad

Reputation: 267514

In your IDE menu, go to Refactor and use Migrate to AndroidX...

enter image description here

Upvotes: 5

Shababb Karim
Shababb Karim

Reputation: 3703

You would require to migrate to Android X if you intend to use features that have breaking changes for the latest library. I personally faced this problem cloud_firestore 0.9.0 as the change log says, it required a migration to Android X.

Your Android app is in the android directory of the project. First open the android directory with Android Studio 3.2+. Then Refactor > Migrate to AndroidX. After that also add these to the gradle.properties file in the android directory

android.useAndroidX=true
android.enableJetifier=true

Upvotes: 17

Related Questions