原因:com.android.builder.dexing.DexArchiveBuilderException:処理に失敗しました
Caused Com Android
今日、android studioを3.2にアップグレードした後、多くの問題が見つかりました。一時的な記録は次のとおりです。
Caused by: com.android.builder.dexing.DexArchiveBuilderException: Failed to process /Users/xxx/.gradle/caches/transforms-1/files-1.1/butterknife-runtime-9.0.0-rc2.aar/020f27787defbf924ab1f60f13609c35/jars/classes.jar
image.png
また、インターネットを長い間検索したところ、問題の解決策は非常に簡単で、build.gradle(Module:app)ファイルに2行のコードを追加するだけであることがわかりました。
// Here is the need to add code compileOptions { sourceCompatibility 1.8 targetCompatibility 1.8 }
これが私の完全なコードです
android { compileSdkVersion 28 defaultConfig { applicationId 'com.xxx.xxx' minSdkVersion 15 targetSdkVersion 28 versionCode 1 versionName '1.0' testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner' } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } // Here is the need to add code compileOptions { sourceCompatibility 1.8 targetCompatibility 1.8 } }
問題の原因は次のとおりです。モジュールでJava1.8を使用する場合は、上記のコードもアプリのgradleに追加する必要があることがわかりました。