[フラッター戦闘]以前に失敗したクラスjava.lang.Classでの再初期化を拒否する
Rejecting Re Init Previously Failed Class Java
このプロジェクトの問題と解決策を記録する
Rejecting re-init on previously-failed class java.lang.Class: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/app/AppCompatActivity
android / app /build.gradleファイルの依存関係セクションに追加されました
implementation 'com.android.support:appcompat-v7:28.0.0'
コンパイルフェーズで合格しなかった場合は、android.supportライブラリをAndroidXに変更できます。
1.distributionUrlパラメーターをandroid / gradle / wrapper /gradle-wrapper.propertiesファイルに置き換えます。
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'
公式ガイド:
FlutterアプリをAndroidXに移行する方法