How to solve Facebook tools:replace=“android:theme”?

前端 未结 5 1857
心在旅途
心在旅途 2020-12-24 10:45

I have

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

My manifest:



        
相关标签:
5条回答
  • 2020-12-24 11:12

    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>
    
    0 讨论(0)
  • 2020-12-24 11:18

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

    This will solve your problem

    (This way you will avoid manifest propery conflict)

    0 讨论(0)
  • 2020-12-24 11:25

    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" />
    
    0 讨论(0)
  • 2020-12-24 11:30

    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" />
    
    0 讨论(0)
  • 2020-12-24 11:32

    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

    0 讨论(0)
提交回复
热议问题