如何解决脸书tools:replace="android:theme"?
How to solve Facebook tools:replace="android:theme"?
我有
compile 'com.facebook.android:facebook-android-sdk:4.16.0'
我的清单:
<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">
如何解决编译错误:
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.
在您的清单中,删除
android:theme="@android:style/Theme.Translucent.NoTitleBar"
在 FacebookActivity
编辑:
您也使用 firebase 吗?如果是这样,请看这里
您只需在 FacebookActivity 的清单中使用 this
<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" />
1) 添加 xmlns:tools="http://schemas.android.com/tools"
到 AndroidManifest
的 <manifest>
元素
2) 添加 tools:replace="android:theme"
到 (facebook activity) <activity>
这是我的清单文件
<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>
试试这个。
<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" />
替换为
<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" />
删除这一行@android:style/Theme.Translucent.NoTitleBar
这将解决您的问题
(这样可以避免明显的 属性 冲突)
我有
compile 'com.facebook.android:facebook-android-sdk:4.16.0'
我的清单:
<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">
如何解决编译错误:
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.
在您的清单中,删除
android:theme="@android:style/Theme.Translucent.NoTitleBar"
在 FacebookActivity
编辑:
您也使用 firebase 吗?如果是这样,请看这里
您只需在 FacebookActivity 的清单中使用 this
<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" />
1) 添加 xmlns:tools="http://schemas.android.com/tools"
到 AndroidManifest
<manifest>
元素
2) 添加 tools:replace="android:theme"
到 (facebook activity) <activity>
这是我的清单文件
<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>
试试这个。
<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" />
替换为
<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" />
删除这一行@android:style/Theme.Translucent.NoTitleBar
这将解决您的问题
(这样可以避免明显的 属性 冲突)