Manifest merger failed on not exists attribute

Viewed 87

I'm actually confused. I try to implement my library to some app project and I get a lot of problems. Some of them I seen before, but one of them actually don't have sense.

This is app manifest:

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

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-feature android:name="android.hardware.camera" android:required="false"/>

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        tools:ignore="GoogleAppIndexingWarning">
        <service android:name=".firebase.FirebaseToken">
            <intent-filter>
                <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
            </intent-filter>
        </service>
        <service android:name=".firebase.FirebaseMsgService">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
            </intent-filter>
        </service>

        <activity android:name=".activities.LoginActivity">
            <intent-filter >
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".activities.MainActivity"
            android:windowSoftInputMode="adjustPan" />
        <activity android:name=".activities.SignupActivity" />
        <meta-data android:name="com.facebook.sdk.ApplicationId"
            android:value="@string/facebook_app_id" tools:replace="android:value"/>

        <activity android:name="com.facebook.FacebookActivity"
            tools:replace="android:configChanges, android:label"
            android:configChanges=
                "keyboard|keyboardHidden|screenLayout|screenSize|orientation"
            android:label="@string/app_name"
            />
        <activity
            android:name="com.facebook.CustomTabActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="@string/fb_login_protocol_scheme" />
            </intent-filter>
        </activity>
    </application>
</manifest>

And the Manifest merger failed on: Merging Errors: Error: Attribute activity#com.twitter.sdk.android.core.identity.OAuthActivity@configChanges value=(orientation|screenSize) from AndroidManifest.xml:30:13-59 is also present at AndroidManifest.xml:120:13-96 value=(keyboard|keyboardHidden|screenLayout|screenSize|orientation). Suggestion: add 'tools:replace="android:configChanges"' to <activity> element at AndroidManifest.xml:28:9-32:40 to override. app main manifest (this file), line 29

The problem here that in my library I have OAuthActivity from twitter sdk but here in this project it simply not exist. So I don't understand where I need to put tools:replace="android:configChanges" from suggestion.

If somebody creates libraries for android and knows how to prevent all manifest merge errors, this will help me a lot. Also it will be good to have some best practices to prevent google service and firebase gradle merge problems.

0 Answers
Related