Manifest問題總結:Error:Execution failed for task ':app:processDebugManifest'. > Manifest m...
1:see logs
Error:Execution failed for task ':app:processDebugManifest'. Manifest merger failed with multiple errors, see logs
開始是矇蔽的,see logs,這個logs按照網上的找出了,但是翻半天沒看到關鍵的具體錯誤在哪裡
直到看到上面的關鍵字:Manifest merger
Manifest的錯誤,後來才發現Manifest的錯誤是需要通過開啟AndroidManifest.xml
檔案自己尋找問題的……我是覺得這方面比較不方便。
ofollow,noindex">https://upload-images.jianshu.io/upload_images/3852552-f0b3e6a669397258.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1000/format/webp
2:多個FileProvider衝突的問題
原連結:https://www.jianshu.com/p/199872d3204f
當應用中存在多個FileProvider的時候(比如在引入了一個第三方開源,例takePhoto,開源框架為了適配android7.0檔案的訪問也使用了FileProvider),在編譯時便會報錯:
在報了錯誤資訊之後androidStudio也給出了一個解決方法,增加 tools:replace="android:authorities"屬性,這麼一來編譯時通過了,但是在使用takePhoto的時候卻出現了致命錯誤UndeclaredThrowableException;
此時我們就會想到使用自定義的FileProvider來避免衝突,既自己寫一個FileProvider繼承自android.support.v4.content.FileProvider,然後在清單檔案裡完成配置;特別要注意一點(被這個細節小坑了一下),在配置自定義的FileProvider的時候,resource指向的xml一定要保證唯一,比如takePhoto使用了最原始的命名file_paths.xml,那麼自定義的FileProvider需要用另一個xml配置(比如file_paths1.xml),避免takePhoto使用的異常(壓縮圖片失敗等問題)