You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

开发移动与穿戴应用时添加Vokaturi遭遇Manifest合并错误求助

解决Wear模块Manifest合并主题冲突问题

这是典型的Android Manifest合并冲突问题,我来帮你快速搞定:核心原因是你引入的OpenVokaturi-3-0-android.aar库的Manifest文件已经定义了android:theme="@style/AppTheme",而你的wear模块自身的Manifest又指定了@android:style/Theme.DeviceDefault,两个相同属性冲突导致编译失败。

具体修复步骤

按照错误提示的建议,只需要修改wear模块的AndroidManifest.xml即可:

  1. 首先在根manifest标签中添加tools命名空间(如果还没添加的话):
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="chun.emotionsensor">
  1. 找到application标签,添加tools:replace="android:theme"属性,强制用你的wear模块主题覆盖库中的主题:
<application
    android:theme="@android:style/Theme.DeviceDefault"
    <!-- 你的其他application属性 -->
    tools:replace="android:theme">

补充说明

如果后续遇到其他Manifest属性冲突(比如android:label、android:icon等),可以在tools:replace中用逗号分隔多个属性,例如:

tools:replace="android:theme,android:label"

你提供的错误信息

Error:Execution failed for task ':wear:processDebugManifest'.
Manifest merger failed : Attribute application@theme value=(@android:style/Theme.DeviceDefault) from AndroidManifest.xml:15:9-59 is also present at [:OpenVokaturi-3-0-android:] AndroidManifest.xml:17:9-40 value=(@style/AppTheme). Suggestion: add 'tools:replace="android:theme"' to element at AndroidManifest.xml:10:5-36:19 to override.

Mobile模块build.gradle代码

apply plugin: 'com.android.application'
android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "chun.emotionsensor"
        minSdkVersion 25
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    wearApp project(':wear')
    implementation 'com.google.android.gms:play-services-wearable:+'
    compile(name: 'OpenVokaturi-3-0-android', ext: 'aar')
    implementation 'com.android.support:support-annotations:27.1.1'
}

Wear模块build.gradle代码

apply plugin: 'com.android.application'
android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "chun.emotionsensor"
        minSdkVersion 25
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.google.android.support:wearable:2.3.0'
    implementation 'com.google.android.gms:play-services-wearable:15.0.1'
    implementation 'com.android.support:percent:26.1.0'
    implementation 'com.android.support:support-v4:26.1.0'
    implementation 'com.android.support:recyclerview-v7:26.1.0'
    implementation 'com.android.support:wear:26.1.0'
    compileOnly 'com.google.android.wearable:wearable:2.3.0'
    compile(name: 'OpenVokaturi-3-0-android', ext: 'aar')
}

错误截图

错误截图

内容的提问来源于stack exchange,提问作者Chun Lu

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 10:09:20