【问题标题】:Manifest merger failed with multiple errors, see logs (Error:Execution failed for task ':app:processDebugManifest')清单合并失败并出现多个错误,请参阅日志(错误:任务':app:processDebugManifest'的执行失败)
【发布时间】:2017-03-05 20:08:57
【问题描述】:

在我问之前,我想声明我搜索了很多类似的线程,但没有一个有效。

我正在调试我的应用程序,由于某种原因,当我清理和重建我的项目时,我得到了 错误清单合并失败,出现多个错误,请参阅日志

在我的 gradle 控制台中,我检查并得到了这个:

C:\Users\Chris\AndroidStudioProjects\WizardCounter2\app\src\main\AndroidManifest.xml:6:5-44:16

错误:在 AndroidManifest.xml:6:5-44:16 的元素活动中缺少“名称”键属性

C:\Users\Chris\AndroidStudioProjects\WizardCounter2\app\src\main\AndroidManifest.xml

错误: 验证失败,退出

这是我的清单:

<?xml version="1.0" encoding="utf-8"?>

<activity
    android:allowBackup="true"
    android:icon="@drawable/counter_launch_icon"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme"
   >

    <activity
        android:name=".HomeScreen"
        android:label="@string/app_name"
        android:theme="@style/AppTheme.NoActionBar"
        android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name=".GameMenu"
        android:label="@string/title_activity_game_menu"
        android:theme="@style/AppTheme.NoActionBar"
        android:screenOrientation="portrait"
        android:value="HomeScreen"/>
    <activity
        android:name=".PlayerSelection"
        android:label="@string/title_activity_player_selection"
        android:value="PlayerSelection"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar"
        >
    </activity>

    <support-screens

        android:smallScreens="true"
        android:normalScreens="true" />
</activity>

还有 build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion '25.0.0'

    defaultConfig {
        applicationId "com.gameapp.android.wizardcounter"
        minSdkVersion 9
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:25.0.0'
    compile 'com.android.support:design:25.0.0'
}

P.S 我正在运行 2.3 版并更新了您所看到的工具...! 提前谢谢大家!

【问题讨论】:

  • 您不能将活动嵌套在活动中,并且您的第一个活动缺少android:name 属性。
  • 在某种程度上你是对的,但在以前的版本中它起作用了……不知道为什么……无论如何,罗伯特的解决方案起作用了!
  • 打开应用程序清单(AndroidManifest.xml),点击清单文件“文本”选项卡旁边的“合并清单”选项卡。您可以在右栏中查看错误,尝试解决错误并重新构建它将解决此错误。错误:readyandroid.wordpress.com/… 更多检查:readyandroid.wordpress.com

标签: java android xml gradle manifest


【解决方案1】:

对我来说这是因为我在清单中声明了两次相同的元标记,看看你是否声明了两次。

【讨论】:

  • 但在我们再次构建时将其删除后会自动添加。我无法修改清单文件。
  • @Shrini Jaiswal +1 投票给你。你节省了我的时间。谢谢。
  • @shanilay86 试试this。该答案更通用,因此可以解决您的问题
【解决方案2】:

像这样放置应用程序并将所有活动放入其中,而不是活动:

<?xml version="1.0" encoding="utf-8"?>
<application
android:allowBackup="true"
android:icon="@drawable/counter_launch_icon"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme"
>

<activity
    android:name=".HomeScreen"
    android:label="@string/app_name"
    android:theme="@style/AppTheme.NoActionBar"
    android:screenOrientation="portrait">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>
<activity
    android:name=".GameMenu"
    android:label="@string/title_activity_game_menu"
    android:theme="@style/AppTheme.NoActionBar"
    android:screenOrientation="portrait"
    android:value="HomeScreen"/>
<activity
    android:name=".PlayerSelection"
    android:label="@string/title_activity_player_selection"
    android:value="PlayerSelection"
    android:screenOrientation="portrait"
    android:theme="@style/AppTheme.NoActionBar"
    >
</activity>

<support-screens

    android:smallScreens="true"
    android:normalScreens="true" />
</application>

【讨论】:

  • 有时您会在清单的应用程序标签内多次重复相同的活动标签。尝试删除多余的活动标签
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-06-28
  • 1970-01-01
  • 2017-04-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多