Solving AndroidX errors in Flutter

Bhavik Makwana
Flutter Community
Published in
2 min readApr 5, 2019

--

As the title suggests, in this article I’m going to explain how you can resolve AndroidX errors that you face in your Flutter projects.

I’m seeing a lot of Flutter devs banging their heads with the AndroidX error in their Flutter applications. This occurs when a package or dependency used by the app has migrated to AndroidX or when the libraries of android.support are incompatible with AndroidX.

Before starting, I would like to tell what is AndroidX is.

AndroidX is a redesigned library to make package names more clear. So from now on, the Android hierarchy will only be for Android default classes that come with the Android operating system. Other library/dependencies will be part of AndroidX and all new development will be updated in AndroidX.

Example:
Old com.android.support:recyclerview-v7
New androidx.recyclerview:recyclerview:1.0.0

Ok, but how to solve this???

There is a chance that the packages you’re using in your application may not be updated with the AndroidX, so you can simply downgrade your package version.

But if this doesn’t work then you can follow the steps below to solve the issue. But before you do that, make sure you have installed the latest Android Studio on your system, and also back up your project (Safety first 😉).

  1. In your IDE (VScode/Android Studio), on the left in the file tree, right-click on the Android module where you see the option, “Open in Android Studio”.
  2. In Android Studio there is an option to migrate your project to AndroidX. Go to Refactor Menu > Refactor/Migrate to AndroidX
  3. That’s it, you’re done. Your project is migrated to AndroidX.

If you found this article helpful, remember you can press the clap 👏 button up to 50 times! 😉

You can find me on Twitter, Linkedin, and Github by just searching for ibhavikmakwana.
If that doesn’t help you can drop a mail on ibhavikmakwana@gmail.com 😃

--

--

Bhavik Makwana
Flutter Community

Flutter Enthusiast | Google Certified Associate Android Developer | Speaker for flutter | Android Dev | Flutter Dev