AndroidX compatibility

If we receive a build failed with AndroidX incompatibilities, this article shows how to upgrade Android project to AndroidX.

The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
See for more information on the problem and how to fix it.


First make sure that compileSdkVersion is at least 28 in app/build.gradle. This property controls the version of the Android SDK that Gradle uses to build your APK.

android {
    compileSdkVersion 28

Migrating to AndroidX

With Android Studio 3.2 and higher, you can quickly migrate an existing project to use AndroidX by selecting Refactor > Migrate to AndroidX from the menu bar.

When opening project, update Android Gradle Plugin if asked.

In bottom of Android Studio, click on Do Refactor button.

Close Android Studio and reopen Flutter project in Visual Studio Code.

Synchronize now

Flutter project is now migrated to AndroidX and you can build apk.