Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Merged Manifest Warning after upgrading Android Studio to 3.2.1

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.

like image 396
Venu G. Avatar asked Oct 20 '18 22:10

Venu G.


3 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" />

like image 121
kasun sampath adhikari Avatar answered Sep 18 '22 20:09

kasun sampath adhikari


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" />
like image 32
Tony Jara Avatar answered Sep 21 '22 20:09

Tony Jara


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.

like image 25
Martin Zeitler Avatar answered Sep 17 '22 20:09

Martin Zeitler