Java 清单合并失败并出现多个错误,请参阅日志(错误:任务 ':app:processDebugManifest' 的执行失败)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/42613369/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Manifest merger failed with multiple errors, see logs (Error:Execution failed for task ':app:processDebugManifest')
提问by Chris Vera
Before I ask I want to state that I searched through a lot of similar threads but none of them worked.
在我问之前,我想说明我搜索了很多类似的线程,但没有一个起作用。
I was debugging my app and for some reason when I cleaned and rebuilded my project I got the error: Manifest merger failed with multiple errors, see logs
我正在调试我的应用程序,出于某种原因,当我清理和重建我的项目时,我收到错误:清单合并失败,出现多个错误,请参阅日志
In my gradle console I checked and got this:
在我的 gradle 控制台中,我检查并得到了这个:
C:\Users\Chris\AndroidStudioProjects\WizardCounter2\app\src\main\AndroidManifest.xml:6:5-44:16
C:\Users\Chris\AndroidStudioProjects\WizardCounter2\app\src\main\AndroidManifest.xml:6:5-44:16
Error:Missing 'name' key attribute on element activity at AndroidManifest.xml:6:5-44:16
错误:AndroidManifest.xml:6:5-44:16 元素活动中缺少“名称”关键属性
C:\Users\Chris\AndroidStudioProjects\WizardCounter2\app\src\main\AndroidManifest.xml
C:\Users\Chris\AndroidStudioProjects\WizardCounter2\app\src\main\AndroidManifest.xml
Error: Validation failed, exiting
错误:验证失败,退出
Here is my manifest:
这是我的清单:
<?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>
And the build.gradle:
和 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 I'm running version 2.3 and updated the tools as you see...! Thank you in advance everyone!
PS 我正在运行 2.3 版并更新了工具,如您所见......!先谢谢大家!
采纳答案by vicky
Instead of activity put application and put all activities inside it like this:
而不是活动放置应用程序并将所有活动放入其中,如下所示:
<?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>
回答by Shrini Jaiswal
For me its was because I had declared the same meta tag twice in the manifest , Look if u have declared something twice .
对我来说,这是因为我在清单中两次声明了相同的元标记,看看你是否已经声明了两次。