Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ActivityNotFoundException when using Facebook plugin with Unity

I'm using Unity 5.2.2p2, Facebook Unity SDK 7.2.2 and the Prime31's Android IAB plugin 2.9. When I compile my app and run it on a device, in the adb logs I see this:

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.

However in the Assets/Plugins/Android/AndroidManifest.xml file, I've got the following definitions:

<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"/>

It makes no sense to me. This used to work, and I'm not sure why it doesn't anymore.

like image 952
ReaperUnreal Avatar asked Dec 03 '15 21:12

ReaperUnreal


Video Answer


1 Answers

Just want to answer that I've managed to fix it. It's one of those Unity things where you just have to uninstall all your plugins and reinstall them again. Find every single file related to both plugins, delete them, install them one at a time again.

Furthermore, with the new Smoola integration in 2.9, if you're not using Smoola, the plugin loads anyway and checks for internet access. This needs the ACCESS_NETWORK_STATE permission which the Prime31 manifest doesn't include.

like image 195
ReaperUnreal Avatar answered Oct 07 '22 08:10

ReaperUnreal