天天看點

解決ailed to transform artifact 'butterknife-runtime.aar (com.jakewharton:butterknife-runtime:10.2.0)'

今天把項目全部從support替換成AndroidX,Android Studio的版本更新成3.5.1,報了一個很奇怪的錯,錯誤資訊如下:

FAILURE: Build failed with an exception.

* What went wrong:

Execution failed for task ':app:mergeExtDexDebug'.

> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.

   > Failed to transform artifact 'butterknife-runtime.aar (com.jakewharton:butterknife-runtime:10.2.0)' to match attributes {artifactType=android-dex, dexing-is-debuggable=true, dexing-min-sdk=19}

      > Execution failed for DexingTransform: C:\Users\Administrator\.gradle\caches\transforms-2\files-2.1\c0d9910fc7a4452c3be877d137ec3ad7\jars\classes.jar.

         > Error while dexing.

* Try:

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

截圖如下:

解決ailed to transform artifact 'butterknife-runtime.aar (com.jakewharton:butterknife-runtime:10.2.0)'

解決方法如下:給所有的 Module 加入jdk1.8

在App的build.gradle檔案中的android 下加入如下代碼即可解決 :

compileOptions {
    sourceCompatibility = '1.8'
    targetCompatibility = '1.8'
}
           
解決ailed to transform artifact 'butterknife-runtime.aar (com.jakewharton:butterknife-runtime:10.2.0)'