close

建新的Android 專案時,sync project with gradle files 遇到下述的錯誤:

ERROR: Manifest merger failed with multiple errors, see logs

 

如何在Android Studio中找到這個 log 呢,先點專案的 AndroidManifest.xml,然後下方會有一個 Merged Manifest 的頁籤。

圖片1.png

 

由於我前幾天才新建另一個Android Project,就拿來比對,發現 build.gradle (Module:app) 裡面引用的版本不同,猜測就是版本問題,原本有問題的如下:

implementation 'androidx.appcompat:appcompat:1.3.0'

implementation 'androidx.constraintlayout:constraintlayout:2.0.4'

testImplementation 'junit:junit:4.12'

androidTestImplementation 'androidx.test.ext:junit:1.1.3'

androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

 

改成:

implementation 'androidx.appcompat:appcompat:1.0.2'

implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

testImplementation 'junit:junit:4.12'

androidTestImplementation 'androidx.test.ext:junit:1.1.0'

androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'

 

這樣就可以正確執行。

 

[20210901補充]

我開發Google map相關功能時也有遇到這情況,我把下述版本降版就過關了:

implementation 'com.google.android.gms:play-services-maps:17.0.1'

變成

implementation 'com.google.android.gms:play-services-maps:16.0.0'

 

Referece:

https://stackoverflow.com/questions/55217992/manifest-merger-failed-attribute-applicationappcomponentfactory-androidx

arrow
arrow
    全站熱搜

    葛瑞斯肯 發表在 痞客邦 留言(0) 人氣()