更新时间:2023-02-02 20:48:26
2.在android/build.gradle中,替换:
2.In android/build.gradle, replace:
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
作者
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
}
3.在android/gradle.properties中,添加
3.In android/gradle.properties, append
android.enableJetifier=true
android.useAndroidX=true
4.在android/app/build.gradle中:
4.In android/app/build.gradle:
在android {下,请确保compileSdkVersion和targetSdkVersion至少为28.
Under android {, make sure compileSdkVersion and targetSdkVersion are at least 28.
5.用AndroidX等效项替换所有不推荐使用的库.例如,如果您使用默认的.gradle文件,请进行以下更改:
5.Replace all deprecated libraries with the AndroidX equivalents. For instance, if you’re using the default .gradle files make the following changes:
在android/app/build.gradle中
In android/app/build.gradle
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
作者
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
最后,在依赖项下替换
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'