1. 程式人生 > >Android檔案合併時,打包出錯

Android檔案合併時,打包出錯

Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute meta-data#[email protected] value=(26.0.0-alpha1) from [com.android.support:appcompat-v7:26.0.0-alpha1] AndroidManifest.xml:27:9-38
is also present at [com.android.support:support-v13:25.3.1] AndroidManifest.xml:27:9-31 value=(25.3.1).
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:25:5-27:41 to override.

重點是:Attribute meta-data#Android[email protected] value=(25.3.0) 

這裡在build合併的時候出現了錯誤。看有的文章中,差不多也是這樣的問題,因為多渠道 引用的versionCode versionName 一類的問題等等。

解決方案:

1.Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:25:5-27:34 to override.按照官方報錯添加了,但是並沒有解決問題。

2.build.gradle根標籤上加上useOldManifestMerger true,試了下也沒有解決問題

3.在build.gradle中新增如下程式碼(任意位置)

configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
if (!requested.name.startsWith(
"multidex")) { details.useVersion '25.3.0' } } } }

轉載地址:http://blog.csdn.net/piitw/article/details/65935059點選開啟連結