NickUnuchek
NickUnuchek

Reputation: 12887

How to solve Facebook tools:replace="android:theme"?

I have

compile 'com.facebook.android:facebook-android-sdk:4.16.0'

My manifest:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
...
    <application
            android:name=".MyApplication"
            android:allowBackup="true"
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name"
            android:theme="@style/AutoTheme"
            tools:replace="android:theme">

How to solve compile error:

Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute activity#com.facebook.FacebookActivity@theme value=(@android:style/Theme.Translucent.NoTitleBar) from AndroidManifest.xml:69:13-72
    is also present at [com.facebook.android:facebook-android-sdk:4.16.0] AndroidManifest.xml:32:13-63 value=(@style/com_facebook_activity_theme).
    Suggestion: add 'tools:replace="android:theme"' to <activity> element at AndroidManifest.xml:66:9-70:47 to override.

Upvotes: 58

Views: 31104

Answers (6)

CoolMind
CoolMind

Reputation: 28845

In my case I changed the attribute android:theme="${appTheme}" (where manifestPlaceholders["appTheme"] = "@style/Theme2" in build.gradle) and got a compile error:

Execution failed for task ':app:processGoogleDebugManifest'. Manifest merger failed : Attribute application@theme value=(@style/Theme) from AndroidManifest.xml:23:9-42 is also present at AndroidManifest.xml:21:9-36 value=(@style/Theme2).
Suggestion: add 'tools:replace="android:theme"' to element at AndroidManifest.xml:15:5-92:19 to override.

I have 3 AndroidManifest files. Then I changed android:theme in all 3 files.

Upvotes: 0

Manoj Behera
Manoj Behera

Reputation: 2835

Remove this line @android:style/Theme.Translucent.NoTitleBar

This will solve your problem

(This way you will avoid manifest propery conflict)

Upvotes: 1

Viking93
Viking93

Reputation: 269

You Just have to use the this in your Manifest for the FacebookActivity

  <activity android:name="com.facebook.FacebookActivity"
            android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
            tools:replace="android:theme"
            android:theme="@android:style/Theme.Translucent.NoTitleBar"
            android:label="@string/app_name" />

Upvotes: 3

Jignesh Goyani
Jignesh Goyani

Reputation: 1020

Try this.

 <activity
                android:name="com.facebook.FacebookActivity"
                android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
                android:label="@string/app_name"
                android:theme="@android:style/Theme.Translucent.NoTitleBar" />

Replace to

  <activity
            android:name="com.facebook.FacebookActivity"
            android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
            android:label="@string/app_name"
            android:theme="@style/com_facebook_activity_theme" />

Upvotes: 7

Pir Shukarullah Shah
Pir Shukarullah Shah

Reputation: 4252

1) Add xmlns:tools="http://schemas.android.com/tools" to <manifest> element at AndroidManifest

2) Add tools:replace="android:theme" to (facebook activity) <activity>

Here is my manifest file

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.company.product" xmlns:tools="http://schemas.android.com/tools">

    ...

    <application
      android:allowBackup="true"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:theme="@style/AppTheme"
      android:name="MyApplication">
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
        <intent-filter>
            ...
        </intent-filter>
      </activity>

      <!--FacebookActivity-->
      <activity
        tools:replace="android:theme"
        android:name="com.facebook.FacebookActivity"
        android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.Translucent.NoTitleBar"/>

        ...

      </application>

</manifest>

Upvotes: 105

Al Wld
Al Wld

Reputation: 939

In your manifest, remove

android:theme="@android:style/Theme.Translucent.NoTitleBar"

in the FacebookActivity

Edit: Do you use firebase as well? If so, have a look here Android manifest merger with facebook and firebase libraries

Upvotes: 4

Related Questions