Your app isn’t using Android X

Time:2020-11-11

Today, in the process of learning the development of flutter, I wrote a basic demo. I want to make a formal installation package APK and install it on the mobile phone to experience the effect.

After configuring the Android signature file, run the fluent build app command line to build a formal (release) package. During the construction process, the following prompt appears, but it can be built successfully.

[!] Your app isn't using AndroidX.
    To avoid potential build failures, you can quickly migrate your app by following the steps on https://goo.gl/CP92wY.

Your app isn't using Android X
The package that has been built successfully can’t be found on the Android studio ide. You need to enter the file directory to find your project. The packaged project is located at:

The packaged APK is located in < app dir > / build / APP / outputs / APK / APP- release.apk 。
But it’s always uncomfortable to have this hint, right? Try to solve it.

According to the prompt, we can see that the current project does not use Android x, which is a great improvement of Android system, so it is more important.

AndroidX is a major improvement to the original Android Support Library.
​
It provides the androidx.* package libraries, unbundled from the platform API. This means that it offers backward compatibility and is updated more frequently than the Android platform.

In the description of the official website of flutter, the migration problem of androidx migration is also specifically mentioned, and some corresponding solutions are given by way of Q & A.
For this project, we only need to add two lines of code to solve the problem.
stay gradle.properties Add the following code to the

android.enableJetifier=true
android.useAndroidX=true

Your app isn't using Android X
After that, the command line “builtk” will not appear again.

Tips:

If you have installed a debug version of the app on your phone, remember to uninstall the original debug app before installing the official app.

Welcome to my official account, Junwei said.