Merged Manifest Warning after upgrading Android Studio to 3.2.1

Viewed 18399

After upgrading to Android Studio 3.2.1, when editing the AndroidManifest.xml file, I see my <application> section of the file highlighted in yellow (presumably due to warning below). I also see a new tab titled Merged Manifest which contains the warning :

Merging Errors: Warning activity#com.google.firebase.auth.internal.FederatedSignInActivity@android:launch Mode was tagged at AndroidManifest.xml:24 to replace other declarations but no other declaration present app main manifest (this file), line 23

Questions:

  1. Is this new tab something new in AS 3.2.1? Or is it showing up since AS 3.2.1 is finding a new warning that the previous version did not?

  2. What is the warning about? Do I need to add an activity in my app's AndroidManifest.xml for Firebase for some reason?

  3. How do I fix it?

(Note: there was probably a Firebase update as well around the same time.)

Firebase is up-to-date at present.

implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-crash:16.2.1'

Everything compiles and runs fine in spite of this.

7 Answers

First add the following activity to the application node in the manifest additions:

<activity
    android:name="com.google.firebase.auth.internal.FederatedSignInActivity"
    android:excludeFromRecents="true"
    android:exported="true"
    android:launchMode="singleInstance"
    android:permission="com.google.firebase.auth.api.gms.permission.LAUNCH_FEDERATED_SIGN_IN"
    android:theme="@android:style/Theme.Translucent.NoTitleBar"
    tools:replace="android:launchMode" />

Then add following to the Manifest.xml:

<service android:name="com.google.firebase.components.ComponentDiscoveryService" />
<meta-data
    android:name="com.google.firebase.components:com.google.firebase.auth.FirebaseAuthRegistrar"
    android:value="com.google.firebase.components.ComponentRegistrar" />
<meta-data
    android:name="com.google.firebase.components:com.google.firebase.analytics.connector.internal.AnalyticsConnectorRegistrar"
    android:value="com.google.firebase.components.ComponentRegistrar" />
<meta-data
    android:name="com.google.firebase.components:com.google.firebase.iid.Registrar"
    android:value="com.google.firebase.components.ComponentRegistrar" />

the issue was introduced with firebase-auth:16.0.5...

keeping that dependency at the previous version is a possible workaround:

dependencies {
    ...

    //noinspection GradleDependency
    implementation "com.google.firebase:firebase-auth:16.0.4"
}

one possibly can ignore that warning, so far noticed no side effects.

I made it work putting the following line in AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" //add this line
    ...>     

and only the following self closing activity tag.

<activity
    android:name="com.google.firebase.auth.internal.FederatedSignInActivity"
    android:excludeFromRecents="true"
    android:exported="true"
    android:launchMode="singleInstance"
    android:permission="com.google.firebase.auth.api.gms.permission.LAUNCH_FEDERATED_SIGN_IN"
    android:theme="@android:style/Theme.Translucent.NoTitleBar"
    tools:replace="android:launchMode" />

I had the same issue. It was not due to Firebase.

I had created a new launcher icon that I called my_launcher. The 2 generated files my_launcher.xml and my_launcher_round.xml had errors.

For my case, it didn't find @mipmap/ic_launcher_background for the background tag. I removed it and the rebuild worked.

I reproduce issue came if you have package with Uppercase, please re-check your naming package. to solve this issue make all package name you created to lowercase.

before

after

open command prompt and then type below command

cd android && gradlew clean

Figured out what was causing this !

The whole <application>...</application> section was being highlighted because of the warning

enter image description here

I was able to fix the issue by adding the line

<application

      ..

      tools:ignore="GoogleAppIndexingWarning"

      ..>
      ..

</application>

Alternately, one may want to add a link from a URL - for more info, see enter link description here

https://stackoverflow.com/users/8278273/vinit-poojary, hope this helps you.

Related