I just created a new flutter project, added a few plugins and I\'m getting the plugin switched to android x therefore i need to switch to android x. I\'ve tried all the diff
As you are creating a new project, just follow @harsh 's answer and you're done.
However, as I recently upgraded my existing app to use new plugins, I had to migrate to AndroidX as well... and the default procedure in the official instructions didn't work, which is using Android Studio to migrate the project - it said "No usages found!".
So what I did was:
android/gradle.properties
and addedandroid.useAndroidX=true
android.enableJetifier=true
opened android/build.gradle
and changed
com.android.tools.build:gradle
to version 3.3.0
com.google.gms:google-services
to version 4.2.0
opened android/app/build.gradle
and
compileSdkVersion
to 28
android.support.test.runner.AndroidJUnitRunner
to androidx.test.runner.AndroidJUnitRunner
com.android.support.test:runner
to androidx.test:runner:1.1.0
com.android.support.test.espresso:espresso-core
to androidx.test.espresso:espresso-core:3.1.0
opened android/gradle/wrapper/gradle-wrapper.properties
and changed distributionUrl
to https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
(you might have to use 5.4.1, please see update below)
executed flutter clean
And contrary to what I expected, IT WORKED! :)
When updating my app to flutter v1.9.1+hotfix.5
, as I use app signing, I was stuck with the error SigningConfig "release" is missing required property "storePassword"
and in the end it was the gradle version from step 7 above. So now I'm using 5.4.1 as suggested in this wiki.
[android/gradle/wrapper/gradle-wrapper.properties]
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
I faced the similar problem.
This Medium article helped me to find 75% solution for my problem
I followed the steps mentioned in this article. and I'm stuck in the end
Android studio is not allowed me to open android module (folder) from the project structure directly. So I opend manually in the new window of android studio.
Android is not refactored the gradle testRunner
classpath
androidTestImplementation
it is prompting like is dependent So then I manually replaced all the paths like.
android.support.test.runner.AndroidJUnitRunner
to androidx.test.runner.AndroidJUnitRunner
com.android.support.test:runner
to androidx.test:runner:1.1.0
com.android.support.test.espresso:espresso-core
to androidx.test.espresso:espresso-core:3.1.0
and at the end I added to android/gradle.properties
android.useAndroidX=true
android.enableJetifier=true
Then ran the application. ;) after that androidX warning disappeared.
Faced with the same issue.
In my build.gradle compileSdkVersion and targetSdkVersion were already set to 28. minSdkVersion was set to 23.
Had already added android.useAndroidX=true android.enableJetifier=true to my android/graddle.properties.
After adding all these still migrating to AndroidX was not possible. When doing so a message pop up saying "No usage found in this project"
Adding the following code to my app/build.gradle solved the issue.
android {
defaultConfig {
...
minSdkVersion 23
targetSdkVersion 28
multiDexEnabled true
}
}
dependencies {
implementation 'com.android.support:multidex:1.0.3'
}