在此记录项目中所遇到问题及解决方案
Rejecting re-init on previously-failed class java.lang.Class<com.yalantis.ucrop.UCropActivity>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/app/AppCompatActivity
在android/app/build.gradle文件中的dependencies节添加
implementation 'com.android.support:appcompat-v7:28.0.0'
如果在编译阶段不通过,可以android.support库换成AndroidX
1.在android/gradle/wrapper/gradle-wrapper.properties文件中把distributionUrl参数换成:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
- 在android/build.gradle文件中把
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
换成
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
}
- 在android/gradle.properties文件中加
android.enableJetifier=true
android.useAndroidX=true
In android/app/build.gradle:
- compileSdkVersion 和 targetSdkVersion 必须是28以上.
- 在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'
网友评论