You need to have compileSdk set to at least 28 in your module build.gradle to migrate to AndroidX Flutter Issue Fix
You may face this Flutter AndroidX error when you try to migrate your Flutter project to AndroidX. In Android Studio, you would come across a dialog box saying: You need to have compileSdk set to at least 28 in your module build.gradle to migrate to AndroidX
So, how to fix this Flutter issue?
Open the android folder inside your Flutter project with Android Studio. When the Android Studio prompts you to upgrade the gradle version, make sure to update the gradle version. Now, install Google Play Services by going to tools>sdk manager>sdk tools.
That’s it. Now retry AndroidX migration by going to refractor and migrate to AndroidX option. The Flutter error would be gone.