How to migrate your Flutter app to AndroidX

Gabriel Rodríguez
1 min readFeb 27, 2019

If you’re getting build (Gradle) errors when adding recent versions of plugins, and if you’re having trouble following the instructions on the Android site, follow these instructions.

Under android/app/build.gradle, do the following changes:

Replace compileSdkVersion 27 with compileSdkVersion 28.

Under defaultConfig {:

Replace targetSdkVersion 27 with targetSdkVersion 28.

Replace android.support.test.runner.AndroidJUnitRunner with androidx.test.runner.AndroidJUnitRunner.

Under dependencies {:

Replace com.android.support.test.runner:1.0.2 with androidx.test.runner:1.1.1 and com.android.support.test.espresso:espresso-core:3.0.2 with androidx.test.espresso:espresso-core:3.1.1. (Version numbers may vary)

In android/gradle/wrapper/gradle-wrapper.properties

Change the line starting with distributionUrl like this:

distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip

In android/build.gradle

Under dependencies {, change classpath 'com.android.tools.build:gradle:3.2.1' to classpath 'com.android.tools.build:gradle:3.3.0' .

In android/gradle.properties

Append the following:

android.enableJetifier=true
android.useAndroidX=true

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Responses (2)

Write a response