簡體   English   中英

與Unity使用Facebook插件時的ActivityNotFoundException

[英]ActivityNotFoundException when using Facebook plugin with Unity

我正在使用Unity 5.2.2p2,Facebook Unity SDK 7.2.2和Prime31的Android IAB插件2.9。 當我編譯我的應用程序並在設備上運行它時,在adb日志中我看到:

I/Unity   (18149): AndroidJavaException: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.-----.----/com.facebook.unity.FBUnityLoginActivity}; have you declared this activity in your AndroidManifest.xml?
I/Unity   (18149):   at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <filename unknown>:0 
I/Unity   (18149):   at UnityEngine.AndroidJNISafe.CallStaticVoidMethod (IntPtr clazz, IntPtr methodID, UnityEngine.jvalue[] args) [0x00000] in <filename unknown>:0 
I/Unity   (18149):   at UnityEngine.AndroidJavaObject._CallStatic (System.String methodName, System.Object[] args) [0x00000] in <filename unknown>:0 
I/Unity   (18149):   at UnityEngine.AndroidJavaObject.CallStatic (System.String methodName, System.Object[] args) [0x00000] in <filename unknown>:0 
I/Unity   (18149):   at Facebook.Unity.Mobile.Android.FBJavaClass.CallStatic (System.String methodName, System.Object[] args) [0x00000] in <filename unknown>:0 
I/Unity   (18149):   at Facebook.Unity.Mobile.Android.AndroidFacebook.CallFB (System.String method, System.String args) [0x00000] in <filename unknown>:0 
I/Unity   (18149):   at Facebook.Unity.

但是在Assets / Plugins / Android / AndroidManifest.xml文件中,我有以下定義:

<activity android:configChanges="locale|fontScale|keyboard|keyboardHidden|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" android:label="@string/app_name" android:launchMode="singleTask" android:name="com.unity3d.player.UnityPlayerActivity" android:screenOrientation="sensorLandscape">
    <intent-filter>
        <action android:name="android.intent.action.MAIN"/>
        <category android:name="android.intent.category.LAUNCHER"/>
        <category android:name="android.intent.category.LEANBACK_LAUNCHER"/>
    </intent-filter>
    <meta-data android:name="unityplayer.UnityActivity" android:value="true"/>
</activity>
<activity android:configChanges="locale|fontScale|keyboard|keyboardHidden|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" android:name="com.facebook.unity.FBUnityLoginActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
<activity android:configChanges="locale|fontScale|keyboard|keyboardHidden|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" android:name="com.facebook.unity.FBUnityDialogsActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
<activity android:configChanges="keyboardHidden|orientation" android:name="com.facebook.LoginActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
<activity android:exported="true" android:name="com.facebook.unity.FBUnityAppLinkActivity"/>
<activity android:exported="true" android:name="com.facebook.unity.FBUnityDeepLinkingActivity"/>
<activity android:name="com.facebook.unity.FBUnityGameRequestActivity"/>
<activity android:name="com.facebook.unity.FBUnityCreateGameGroupActivity"/>
<activity android:name="com.facebook.unity.FBUnityJoinGameGroupActivity"/>
<activity android:name="com.facebook.unity.AppInviteDialogActivity"/>
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="fb1234removed"/>
<provider android:authorities="com.facebook.app.FacebookContentProvider1234removed" android:exported="true" android:name="com.facebook.FacebookContentProvider"/>
<activity android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize" android:label="@string/app_name" android:name="com.facebook.FacebookActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
<activity android:configChanges="keyboard|keyboardHidden|layoutDirection|orientation|screenLayout|screenSize|uiMode" android:name="com.prime31.GoogleIABProxyActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>

對我來說完全是無稽之談。 這曾經工作,我不知道為什么它不再存在。

只是想回答我已經設法修復它。 這是Unity之一,您必須卸載所有插件並重新安裝它們。 找到與這兩個插件相關的每個文件,刪除它們,再一次安裝一個。

此外,隨着新的Smoola集成在2.9中,如果你沒有使用Smoola,那么無論如何插件都會加載並檢查互聯網訪問。 這就需要ACCESS_NETWORK_STATE ,其中許可Prime31清單不包括。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM