美文网首页
[Flutter 实战] Rejecting re-init o

[Flutter 实战] Rejecting re-init o

作者: 寅丁 | 来源:发表于2019-05-20 15:37 被阅读0次

在此记录项目中所遇到问题及解决方案

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
  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
In android/app/build.gradle:
  1. compileSdkVersion 和 targetSdkVersion 必须是28以上.
  1. 在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'

官方指南:
How to migrate a Flutter app to AndroidX

相关文章

网友评论

      本文标题:[Flutter 实战] Rejecting re-init o

      本文链接:https://www.haomeiwen.com/subject/rxmkzqtx.html