运行时清单合并失败 [英] Manifest merger failed while running

查看:50
本文介绍了运行时清单合并失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Android:清单合并失败 com.android.support:support-v4:26.1.0

我似乎收到以下错误:

<块引用>

清单合并失败:属性元数据#android.support.VERSION@value value=(26.0.2) from [com.android.support:percent:26.0.2] AndroidManifest.xml:25:13-35也存在于 [com.android.support:support-v4:26.1.0] AndroidManifest.xml:28:13-35 value=(26.1.0).建议:在 AndroidManifest.xml:23:9-25:38 的元素中添加 'tools:replace="android:value"' 以覆盖.

我该如何解决这个问题?这是我的应用的 build.gradle 文件:

android {compileSdkVersion 28buildToolsVersion '28.0.2'默认配置{applicationId "tw.com.iac.sam_qw25"minSdk 版本 23目标SDK版本28版本代码 1版本名称1.0"testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"}...}依赖{实现文件树(目录:'libs',包括:['*.jar'])实现 'com.google.android.support:wearable:2.4.0'实现 'com.google.android.gms:play-services-wearable:16.0.1'实现 'androidx.percentlayout:percentlayout:1.0.0'实现 'com.android.support:percent:26.0.2'实现 'androidx.recyclerview:recyclerview:1.0.0'compileOnly 'com.google.android.wearable:wearable:2.4.0'实现 'com.android.support.constraint:constraint-layout:1.1.3'testImplementation 'junit:junit:4.12'androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'}

这是项目的 build.gradle:

buildscript {存储库{谷歌()jcenter()}依赖{类路径 'com.android.tools.build:gradle:3.2.0'}}所有项目{存储库{谷歌()jcenter()}}任务清理(类型:删除){删除 rootProject.buildDir}

解决方案

  1. 转到您的 app/src/main/AndroidManifest.xml 文件
  2. 在应用程序标签内,添加一行

<块引用>

tools:replace="android:value"

  1. 清理/重建您的项目.

如果此类错误发生在多个值上,例如图标、主题、使用明文流量等导致相同错误,请将它们放在工具中:像这样替换标签

 tools:replace="icon,theme,usesCleartextTraffic"

Android: Manifest merger failed com.android.support:support-v4:26.1.0

I seem to be getting the error of:

Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(26.0.2) from [com.android.support:percent:26.0.2] AndroidManifest.xml:25:13-35 is also present at [com.android.support:support-v4:26.1.0] AndroidManifest.xml:28:13-35 value=(26.1.0). Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:23:9-25:38 to override.

How can I solve this problem? This is my app's build.gradle file:

android {
compileSdkVersion 28
buildToolsVersion '28.0.2'
defaultConfig {
    applicationId "tw.com.iac.sam_qw25"
    minSdkVersion 23
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    ...
}dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.google.android.support:wearable:2.4.0'
    implementation 'com.google.android.gms:play-services-wearable:16.0.1'
    implementation 'androidx.percentlayout:percentlayout:1.0.0'
    implementation 'com.android.support:percent:26.0.2'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'
    compileOnly 'com.google.android.wearable:wearable:2.4.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'}

And this is the project's build.gradle:

buildscript {

repositories {
    google()
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.2.0'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
    }

    task clean(type: Delete) {
        delete rootProject.buildDir
    }

解决方案

<application
    android:name=".app.MyApp"
    android:hardwareAccelerated="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:largeHeap="true"
    android:networkSecurityConfig="@xml/network_security_config"
    android:theme="@style/AppTheme"
    android:usesCleartextTraffic="true"
    tools:replace="android:value">

  1. Go to your app/src/main/AndroidManifest.xml file
  2. Inside the application tag, add the line

tools:replace="android:value"

  1. Clean/rebuild your project.

If such errors are occurring for more than one value, like icon, theme, use cleartext traffic, etc. are causing the same error, put them together in the tools: replace tag like this

 tools:replace="icon,theme,usesCleartextTraffic"

这篇关于运行时清单合并失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆