錯誤描述:
Error:Execution failed for task ':app:processMockDebugManifest'.
> Manifest merger failed : Attribute application@allowBackup value=(false) from AndroidManifest.xml:23:9-36
is also present at [net.qiujuer.common:okhttp:3.0.0] AndroidManifest.xml:17:9-35 value=(true).
Suggestion: add 'tools:replace="android:allowBackup"' to <application> element at AndroidManifest.xml:22:5-39:19 to override.
問題分析:
項目依賴庫和主程式的allowBackup沖突
解決方法:
<application tools:replace="android:allowBackup"
android:name=".MyApplication"
android:allowBackup="false" >
添加tools:replace屬性,替換要覆寫的标簽屬性即可。這樣庫檔案中AndroidManifest檔案标簽屬性會被主程式的标簽屬性替換掉。
參考:http://stackoverflow.com/questions/25981156/tools-replace-not-replacing-in-android-manifest