【问题标题】:Android Studio :Error:Execution failed for task ':app:processDebugManifest'. > Manifest merger failed with multiple errors, see logsAndroid Studio:错误:任务':app:processDebugManifest'的执行失败。 > 清单合并失败并出现多个错误,请参阅日志
【发布时间】:2016-12-20 21:31:15
【问题描述】:

我是 Android Studio 新手,遇到了另一个问题。
顺便说一句,我冒着我最后的声誉点的风险。

所以我按照这个网站上的步骤操作:https://developer.android.com/training/basics/supporting-devices/platforms.html 更准确地说是:使用平台样式和主题

我不明白我的错误以及为什么它显示错误。
另外,这个错误是什么意思?

这是我的AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.bog.beg">

    <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="15" />
<!-- SET THE VERSIONS -->

    <application


        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".DisplayMessageActivity"></activity>

        <!-- ACTIVITY SETS -->
        <activity android:theme="@android:style/Theme.Translucent" />


    </application>



</manifest>

如果我添加&lt;activity android:theme="@android:style/Theme.Translucent" /&gt;, 它给了我这个错误

`Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed with multiple errors, see logs`

我看到了我的日志。我不确定是不是这个:

    -- Merging decision tree log ---
manifest
ADDED from C:\Users\bog\AndroidStudioProjects\Beg\app\src\main\AndroidManifest.xml:2:1-33:12
    package
        ADDED from C:\Users\bog\AndroidStudioProjects\Beg\app\src\main\AndroidManifest.xml:3:5-34
        INJECTED from C:\Users\bog\AndroidStudioProjects\Beg\app\src\main\AndroidManifest.xml
        INJECTED from C:\Users\bog\AndroidStudioProjects\Beg\app\src\main\AndroidManifest.xml
    android:versionName
        INJECTED from C:\Users\bog\AndroidStudioProjects\Beg\app\src\main\AndroidManifest.xml
        INJECTED from C:\Users\bog\AndroidStudioProjects\Beg\app\src\main\AndroidManifest.xml
    xmlns:android
        ADDED from C:\Users\bog\AndroidStudioProjects\Beg\app\src\main\AndroidManifest.xml:2:11-69
    android:versionCode
        INJECTED from C:\Users\bog\AndroidStudioProjects\Beg\app\src\main\AndroidManifest.xml
        INJECTED from C:\Users\bog\AndroidStudioProjects\Beg\app\src\main\AndroidManifest.xml
uses-sdk
ADDED from C:\Users\bog\AndroidStudioProjects\Beg\app\src\main\AndroidManifest.xml:5:5-73
MERGED from [com.android.support:appcompat-v7:25.1.0] C:\Users\bog\AndroidStudioProjects\Beg\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\25.1.0\AndroidManifest.xml:21:5-23:78
MERGED from [com.android.support:support-v4:25.1.0] C:\Users\bog\AndroidStudioProjects\Beg\app\build\intermediates\exploded-aar\com.android.support\support-v4\25.1.0\AndroidManifest.xml:21:5-23:54
MERGED from [com.android.support:support-fragment:25.1.0] C:\Users\bog\AndroidStudioProjects\Beg\app\build\intermediates\exploded-aar\com.android.support\support-fragment\25.1.0\AndroidManifest.xml:21:5-23:60
MERGED from [com.android.support:support-media-compat:25.1.0] C:\Users\bog\AndroidStudioProjects\Beg\app\build\intermediates\exploded-aar\com.android.support\support-media-compat\25.1.0\AndroidManifest.xml:21:5-23:63
MERGED from [com.android.support:support-core-ui:25.1.0] C:\Users\bog\AndroidStudioProjects\Beg\app\build\intermediates\exploded-aar\com.android.support\support-core-ui\25.1.0\AndroidManifest.xml:21:5-23:58
MERGED from [com.android.support:support-core-utils:25.1.0] C:\Users\bog\AndroidStudioProjects\Beg\app\build\intermediates\exploded-aar\com.android.support\support-core-utils\25.1.0\AndroidManifest.xml:21:5-23:61
MERGED from [com.android.support:animated-vector-drawable:25.1.0] C:\Users\bog\AndroidStudioProjects\Beg\app\build\intermediates\exploded-aar\com.android.support\animated-vector-drawable\25.1.0\AndroidManifest.xml:20:5-44
MERGED from [com.android.support:support-vector-drawable:25.1.0] C:\Users\bog\AndroidStudioProjects\Beg\app\build\intermediates\exploded-aar\com.android.support\support-vector-drawable\25.1.0\AndroidManifest.xml:21:5-43
MERGED from [com.android.support:support-compat:25.1.0] C:\Users\bog\AndroidStudioProjects\Beg\app\build\intermediates\exploded-aar\com.android.support\support-compat\25.1.0\AndroidManifest.xml:21:5-23:58
    tools:overrideLibrary
        ADDED from [com.android.support:appcompat-v7:25.1.0] C:\Users\bog\AndroidStudioProjects\Beg\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\25.1.0\AndroidManifest.xml:23:9-75
    android:targetSdkVersion
        ADDED from C:\Users\bog\AndroidStudioProjects\Beg\app\src\main\AndroidManifest.xml:5:41-70
        INJECTED from C:\Users\bog\AndroidStudioProjects\Beg\app\src\main\AndroidManifest.xml
        INJECTED from C:\Users\bog\AndroidStudioProjects\Beg\app\src\main\AndroidManifest.xml
    android:minSdkVersion
        ADDED from C:\Users\bog\AndroidStudioProjects\Beg\app\src\main\AndroidManifest.xml:5:15-40
        INJECTED from C:\Users\bog\AndroidStudioProjects\Beg\app\src\main\AndroidManifest.xml
        INJECTED from C:\Users\bog\AndroidStudioProjects\Beg\app\src\main\AndroidManifest.xml
application
ADDED from C:\Users\bog\AndroidStudioProjects\Beg\app\src\main\AndroidManifest.xml:8:5-29:19
MERGED from [com.android.support:appcompat-v7:25.1.0] C:\Users\bog\AndroidStudioProjects\Beg\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\25.1.0\AndroidManifest.xml:25:5-20
MERGED from [com.android.support:support-v4:25.1.0] C:\Users\bog\AndroidStudioProjects\Beg\app\build\intermediates\exploded-aar\com.android.support\support-v4\25.1.0\AndroidManifest.xml:25:5-20
MERGED from [com.android.support:support-fragment:25.1.0] C:\Users\bog\AndroidStudioProjects\Beg\app\build\intermediates\exploded-aar\com.android.support\support-fragment\25.1.0\AndroidManifest.xml:25:5-20
MERGED from [com.android.support:support-media-compat:25.1.0] C:\Users\bog\AndroidStudioProjects\Beg\app\build\intermediates\exploded-aar\com.android.support\support-media-compat\25.1.0\AndroidManifest.xml:25:5-20
MERGED from [com.android.support:support-core-ui:25.1.0] C:\Users\bog\AndroidStudioProjects\Beg\app\build\intermediates\exploded-aar\com.android.support\support-core-ui\25.1.0\AndroidManifest.xml:25:5-20
MERGED from [com.android.support:support-core-utils:25.1.0] C:\Users\bog\AndroidStudioProjects\Beg\app\build\intermediates\exploded-aar\com.android.support\support-core-utils\25.1.0\AndroidManifest.xml:25:5-20
MERGED from [com.android.support:animated-vector-drawable:25.1.0] C:\Users\bog\AndroidStudioProjects\Beg\app\build\intermediates\exploded-aar\com.android.support\animated-vector-drawable\25.1.0\AndroidManifest.xml:22:5-20
MERGED from [com.android.support:support-vector-drawable:25.1.0] C:\Users\bog\AndroidStudioProjects\Beg\app\build\intermediates\exploded-aar\com.android.support\support-vector-drawable\25.1.0\AndroidManifest.xml:23:5-20
MERGED from [com.android.support:support-compat:25.1.0] C:\Users\bog\AndroidStudioProjects\Beg\app\build\intermediates\exploded-aar\com.android.support\support-compat\25.1.0\AndroidManifest.xml:25:5-20
    android:label
        ADDED from C:\Users\bog\AndroidStudioProjects\Beg\app\src\main\AndroidManifest.xml:13:9-41
    android:supportsRtl
        ADDED from C:\Users\bog\AndroidStudioProjects\Beg\app\src\main\AndroidManifest.xml:14:9-35
    android:allowBackup
        ADDED from C:\Users\bog\AndroidStudioProjects\Beg\app\src\main\AndroidManifest.xml:11:9-35
    android:icon
        ADDED from C:\Users\bog\AndroidStudioProjects\Beg\app\src\main\AndroidManifest.xml:12:9-43
    android:theme
        ADDED from C:\Users\bog\AndroidStudioProjects\Beg\app\src\main\AndroidManifest.xml:15:9-40
activity#com.example.bog.beg.MainActivity
ADDED from C:\Users\bog\AndroidStudioProjects\Beg\app\src\main\AndroidManifest.xml:16:9-22:20
    android:name
        ADDED from C:\Users\bog\AndroidStudioProjects\Beg\app\src\main\AndroidManifest.xml:16:19-47
intent-filter#android.intent.action.MAIN+android.intent.category.LAUNCHER
ADDED from C:\Users\bog\AndroidStudioProjects\Beg\app\src\main\AndroidManifest.xml:17:13-21:29
action#android.intent.action.MAIN
ADDED from C:\Users\bog\AndroidStudioProjects\Beg\app\src\main\AndroidManifest.xml:18:17-69
    android:name
        ADDED from C:\Users\bog\AndroidStudioProjects\Beg\app\src\main\AndroidManifest.xml:18:25-66
category#android.intent.category.LAUNCHER
ADDED from C:\Users\bog\AndroidStudioProjects\Beg\app\src\main\AndroidManifest.xml:20:17-77
    android:name
        ADDED from C:\Users\bog\AndroidStudioProjects\Beg\app\src\main\AndroidManifest.xml:20:27-74
activity#com.example.bog.beg.DisplayMessageActivity
ADDED from C:\Users\bog\AndroidStudioProjects\Beg\app\src\main\AndroidManifest.xml:23:9-69
    android:name
        ADDED from C:\Users\bog\AndroidStudioProjects\Beg\app\src\main\AndroidManifest.xml:23:19-57

如果我删除&lt;activity android:theme="@android:style/Theme.Translucent" /&gt;, 没有显示错误,但是为什么会出现这种情况?

我不知道样式是需要自己创建还是默认给定(这对我来说更有意义)。

【问题讨论】:

    标签: android android-activity android-manifest


    【解决方案1】:

    这个错误是什么意思。

    :app:processDebugManifest'。 > Manifest merger failed

    很简单,AndroidManifest.xml 文件中有错误。


    从文档中...

    必须指定名称。

    Android - &lt;activity&gt;

    我在

    中没有看到 android:name
    <activity android:theme="@android:style/Theme.Translucent" />
    

    基本上,我认为您提供的链接试图显示的只是您可以指定存在一个android:theme 属性,该属性可以应用于&lt;activity&gt;&lt;application&gt;

    例如,

    <activity 
        android:name=".DisplayMessageActivity"
        android:theme="@android:style/Theme.Translucent" />
    

    或者你已经拥有的

    <application
        ...
        android:theme="@style/AppTheme">
    

    【讨论】:

    • 只是为了确保我理解。
    • 抱歉,按 Enter 太快了。无论如何::: 不是必需品,但如果我想拥有它,我需要一个名字。我现在设置了一个 android:name="stuff",这意味着我需要在我的应用程序的某个地方使用这个活动(如果我没记错的话)。如果我再次正确,我需要在风格上使用它。是这样吗??
    • 忘记这一切。正如你所提到的,我已经有一个 android:theme... 我只是设置了“@android:style.Thee.Translucent”。这会对我的项目产生不良影响吗??
    • 因为我改了,但现在给我一个错误:FATAL EXCEPTION: main
    • 1) FATAL EXCEPTION: main 来自 Java 错误,您的问题中没有代码,所以我无法回答。 2) 是的android:name 是必需的 3) 不,任何活动都不需要android:theme,除非您想覆盖&lt;application&gt; 中的那个。我不知道您所说的“坏方法”是什么意思,因为您的代码中似乎还有其他错误。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-06-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-17
    • 1970-01-01
    相关资源
    最近更新 更多