3

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:

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

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:

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!

Community
  • 1
  • 1
Chris Vera
  • 113
  • 1
  • 3
  • 10
  • 1
    You can't nest activities inside activities and your first activity is missing the `android:name` attribute. – Titus Mar 05 '17 at 20:16
  • Well in a way you are right but with the previously releases it worked...don't know why...anyway robert's solution worked! – Chris Vera Mar 05 '17 at 20:41
  • Open application manifest(AndroidManifest.xml), click on the "Merged Manifest" tab next to the "Text" tab of the manifest file. You can view the error in the right column, try to solve the error and build again it will solve this error. For error: https://readyandroid.wordpress.com/errorexecution-failed-for-task-appprocessdebugmanifest-manifest-merger-failed-with-multiple-errors-see-logs-android/ For more check: https://readyandroid.wordpress.com/ – Ready Android Jan 16 '18 at 08:33

2 Answers2

8

For me its was because I had declared the same meta tag twice in the manifest , Look if u have declared something twice .

Shrini Jaiswal
  • 1,090
  • 12
  • 12
1

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>
vicky
  • 412
  • 4
  • 18