我实施了Facebook SDK
dependencies {
compile 'com.facebook.android:facebook-android-sdk:4.16.1'
}
并将我的mindSdkVersion
从14更改为15,因为文档Select API 15: Android 4.0.3 or higher and create your new project.
defaultConfig {
applicationId "com.myapp.myapplication"
minSdkVersion 15
targetSdkVersion 23
multiDexEnabled true
}
按照以下步骤我遇到此错误Manifest merger failed with multiple errors
如何解决此问题?
*更新
我忘了将我新创建的class
app扩展到明文中的Application
这里是我的班级
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
// Initialize the SDK before executing any other operations,
FacebookSdk.sdkInitialize(getApplicationContext());
AppEventsLogger.activateApp(this);
}
}
所以我在Manifest
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:name="com.myapp.myapplication.MyApplication">
将android:name="android.support.multidex.MultiDexApplication"
更改为com.myapp.myapplication.MyApplication
并遇到了这个
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:388:13-72
is also present at [com.facebook.android:facebook-android-sdk:4.16.1] AndroidManifest.xml:32:13-63 value=(@style/com_facebook_activity_theme).
Suggestion: add 'tools:replace="android:theme"' to <activity> element at AndroidManifest.xml:385:13-389:48 to override.
答案 0 :(得分:0)
在Manifest
中,我重新安排职位
<meta-data android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id" />
<activity android:name="com.facebook.FacebookActivity"
android:configChanges=
"keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="@string/app_name"
android:screenOrientation="portrait"/>
<provider android:authorities="com.facebook.app.FacebookContentProvider"
android:name="com.facebook.FacebookContentProvider"
android:exported="true" />
答案 1 :(得分:0)
将您的Facebook SDK升级到
implementation 'com.facebook.android:facebook-android-sdk:5.2.0'
像这样在您的Facebook活动标签中添加“ android:replace”
<activity android:name="com.facebook.FacebookActivity"
android:label="@string/app_name"
android:replace="android:theme"/>