问题描述
几天前,我使用了Facebook Unity SDK v5.0.3,并在Android手机上成功进行了测试。 但是今天,我向项目添加了另一个多平台插件(revmob-advertise),因此它更改了我的Androidmanifest.xml。 然后,我无法使用我的Facebook个人资料登录。 我重新导入了最新的Facebook Unity Package,但我认为可能存在一些我不知道的问题,因为我更改了清单并进行了多次构建,结果没有改变。 这是我的Android清单,请帮助我找出问题所在。
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.unity3d.player" android:installLocation="preferExternal" android:theme="@android:style/Theme.NoTitleBar" android:versionCode="1" android:versionName="1.0">
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
<application android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="true">
<activity android:name="com.facebook.unity.FBUnityPlayerActivity" android:launchMode="singleTask" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.unity3d.player.UnityPlayerActivity" android:launchMode="singleTask" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
</activity>
<activity android:name="com.unity3d.player.UnityPlayerNativeActivity" android:launchMode="singleTask" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" />
</activity>
<activity android:name="com.facebook.LoginActivity" android:configChanges="keyboard|orientation|screenSize" android:theme="@android:style/Theme.Translucent.NoTitleBar">
</activity>
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="\ 267548153412434" />
<activity
android:name="com.facebook.unity.FBUnityLoginActivity"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen">
</activity>
<activity android:name="com.facebook.unity.FBUnityDeepLinkingActivity" android:exported="true">
</activity>
</application>
</manifest>
1楼
Facebook Unity SDK不再需要使用主要活动,因此只需将UnityPlayerActivity与“ MAIN”动作意图过滤器或您的插件需要使用的任何东西一起使用,但请确保清单文件包含:
- ApplicationId
- 登录活动
- FBUnityLoginActivity
- FBUnityDeepLinkingActivity
因此,只需添加它即可表明您使用的任何插件都会生成
<activity android:name="com.facebook.LoginActivity" android:configChanges="keyboard|orientation|screenSize" android:theme="@android:style/Theme.Translucent.NoTitleBar">
</activity>
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="\ 267548153412434" />
<activity
android:name="com.facebook.unity.FBUnityLoginActivity"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen">
</activity>
<activity android:name="com.facebook.unity.FBUnityDeepLinkingActivity" android:exported="true">
</activity>