Android 添加依賴報錯彙總 Execution failed for task ':app:processDebugManifest'.

一、解決:添加依賴時報錯;Execution failed for task ':app:processDebugManifest'.

1、添加依賴:com.github.bumptech.glide:glide:4.10.0 報錯
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
  	is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
  	Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:20:5-69:19 to override.

 說是項目合併出錯,配置信息錯誤

2、根據提示,在清單文件中添加 tools:replace="android:appComponentFactory"

 <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher_round"
        tools:replace="android:appComponentFactory"

依然報錯:

Caused by: java.lang.RuntimeException: Manifest merger failed with multiple errors, see logs

解決問題:

3、刪除   tools:replace="android:appComponentFactory",將com.github.bumptech.glide:glide:4.10.0 降低一版本解決問題

    //加載GIF
    implementation 'com.github.bumptech.glide:glide:4.9.0'
//    implementation 'com.github.bumptech.glide:glide:4.10.0'

二、app:javaPreCompileDebug'.  

在工程 build.gradle中添加

   defaultConfig {
         ......

        //app:javaPreCompileDebug'.
        javaCompileOptions { annotationProcessorOptions { includeCompileClasspath = true } }
    }

三、:app:mergeExtDexDebug'.

在 app build.gradle中指定jdk版本

    //:app:mergeExtDexDebug'.
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章