How to migrate your Flutter App to AndroidX

Syed Wajahat Hussain
3 min readFeb 19, 2019

--

I faced this issue when I used latest firebase package in my Flutter App. I spent about 10 days trying to solve this problem. Luckily I found the solution for migrating my “Flutter App” to “AndroidX”

I’m sharing this solution to help others who still facing this problem. I tried my best to keep it simple and expressive as can be.

You need the android studio 3.2 or higher and API level 28 installed.

Lets Start.

I create a new Flutter App and add “firebase_auth” in pubspec.yaml file.

pubspec.yaml

And run the app in emulator which shows the below warning.

Console

We need some steps to solve.

First change your project level build.gradle classpath to com.android.tools.build:gradle:3.3.1.

Now go to you app level build.gradle file and change your compileSdkVersion and targetSdkVersion to 28.

Now right click on android directory in your flutter project go to Flutter and click on Open Android module in Android Studio

and then click on new window.

Now go to to Refactor in tool bar and click Migrate to AndroidX

If you want backup select the check box and click Migrate.

Then click Do Refactor and wait for gradle to build.

Now run your app. It’s done and successfully migrated to AndroidX.

Hope this will solve your problem.

This is my first article about flutter and need more improvements.

--

--