在Flutter的项目中AndroidX Compatibility(AndroidX兼容性)配置

手动迁移应用

  1. android/gradle/wrapper/gradle-wrapper.properties更改以distributionUrl这样开头的行:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
  1. android/build.gradle,替换:
dependencies {
    classpath 'com.android.tools.build:gradle:3.2.1'
}

通过

dependencies {
    classpath 'com.android.tools.build:gradle:3.3.0'
}
  1. android/gradle.properties,附加
android.enableJetifier=true
android.useAndroidX=true
  1. android/app/build.gradle

android {,确保compileSdkVersiontargetSdkVersion至少为28

  1. android/app/build.gradle中做如下更改:
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

通过

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  1. dependencies {,替换
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

通过

androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'

你可能感兴趣的:(Flutter)