facebook / facebook-sdk-for-unity

The facebook sdk for unity.
https://developers.facebook.com/docs/unity
Other
485 stars 256 forks source link

v7.17.0 - FB.Init() Crashing in Android using Unity 2018.2 #277

Open iMagesBlues opened 5 years ago

iMagesBlues commented 5 years ago

Currently using Unity 2018.2.6 Started from an empty project and directly imported v7.17.0

Added the workaround from this issue which causes the first crash (Dependencies.xml): <androidPackage spec="com.facebook.android:facebook-applinks:[5,6)" />

But build still crashes as soon as you press FB.Init Button. Logs as follows:

07-03 21:39:54.555 17707 17736 E CRASH : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000 07-03 21:39:54.555 17707 17736 E CRASH : 07-03 21:39:54.555 17707 17736 E CRASH : Build fingerprint: 'samsung/dreamltexx/dreamlte:7.0/NRD90M/G950FXXU1AQI7:user/release-keys' 07-03 21:39:54.555 17707 17736 E CRASH : Revision: '10' 07-03 21:39:54.555 17707 17736 E CRASH : pid: 17707, tid: 17736, name: UnityMain >>> com.imagine.imagineAR <<< 07-03 21:39:54.555 17707 17736 E CRASH : r0 00000000 r1 00000000 r2 02952163 r3 00000000 07-03 21:39:54.555 17707 17736 E CRASH : r4 c57fe490 r5 00000000 r6 00200782 r7 e55d6ec1 07-03 21:39:54.555 17707 17736 E CRASH : r8 bd835b30 r9 00000000 sl bc733d7c fp c57fe4c8 07-03 21:39:54.555 17707 17736 E CRASH : ip c6b27bec sp c57fe438 lr c5a5b228 pc e7b3f930 cpsr e4324c90 07-03 21:39:54.555 17707 17736 E CRASH : 07-03 21:39:54.555 17707 17736 E CRASH : backtrace: 07-03 21:39:54.690 17707 17736 E CRASH : #00 pc 00018930 /system/lib/libc.so (strlen+71) 07-03 21:39:54.690 17707 17736 E CRASH : #1 pc 00122224 /data/app/com.imagine.imagineAR-2/lib/arm/libunity.so 07-03 21:39:54.690 17707 17736 E CRASH : #2 pc 00127304 /data/app/com.imagine.imagineAR-2/lib/arm/libunity.so 07-03 21:39:54.690 17707 17736 E CRASH : #3 pc 0000f5f4 ( (wrapper managed-to-native) UnityEngine.AndroidJNI:CallStaticStringMethod (intptr,intptr,UnityEngine.jvalue[]) + 0x4c (0xbd0145a8 0xbd014638) [0xdbc50ee0 - Unity Root Domain]+62964) 07-03 21:39:54.691 17707 17736 E CRASH : #4 il ........ at (wrapper managed-to-native) UnityEngine.AndroidJNI.CallStaticStringMethod (intptr,intptr,UnityEngine.jvalue[]) <0xffffffff> 07-03 21:39:54.691 17707 17736 E CRASH : #5 il 0000002c at UnityEngine.AndroidJNISafe.CallStaticStringMethod (intptr,intptr,UnityEngine.jvalue[]) <0x0002c> 07-03 21:39:54.691 17707 17736 E CRASH : #6 il 0000042b at UnityEngine.AndroidJavaObject.CallStatic (string,object[]) <0x0042b> 07-03 21:39:54.691 17707 17736 E CRASH : #7 il 0000003b at UnityEngine.AndroidJavaObject.CallStatic (string,object[]) <0x0003b> 07-03 21:39:54.691 17707 17736 E CRASH : #8 il 0000005f at Facebook.Unity.Android.AndroidWrapper.CallStatic (string) <0x0005f> 07-03 21:39:54.691 17707 17736 E CRASH : #9 il 0000005b at Facebook.Unity.Mobile.Android.AndroidFacebook..ctor (Facebook.Unity.Mobile.Android.IAndroidWrapper,Facebook.Unity.CallbackManager) <0x0005b> 07-03 21:39:54.691 17707 17736 E CRASH : #10 il 0000003f at Facebook.Unity.Mobile.Android.AndroidFacebook..ctor () <0x0003f> 07-03 21:39:54.691 17707 17736 E CRASH : #11 il 0000004f at Facebook.Unity.Mobile.Android.AndroidFacebookLoader.get_FBGameObject () <0x0004f> 07-03 21:39:54.691 17707 17736 E CRASH : #12 il 00000023 at Facebook.Unity.FB/CompiledFacebookLoader.Start () <0x00023> 07-03 21:39:54.691 17707 17736 E CRASH : #13 il 0000006b at (wrapper runtime-invoke) object.runtime_invoke_void_this (object,intptr,intptr,intptr) <0x0006b> 07-03 21:39:54.695 17707 17736 E CRASH : #00 pc 000225d3 /data/app/com.imagine.imagineAR-2/lib/arm/libmono.so 07-03 21:39:54.695 17707 17736 E CRASH : #1 pc 001f7bb8 /data/app/com.imagine.imagineAR-2/lib/arm/libmono.so (mono_runtime_invoke+136) 07-03 21:39:54.695 17707 17736 E CRASH : #2 pc 009ffee8 /data/app/com.imagine.imagineAR-2/lib/arm/libunity.so 07-03 21:39:54.695 17707 17736 E CRASH : #3 pc 00861ebc /data/app/com.imagine.imagineAR-2/lib/arm/libunity.so 07-03 21:39:54.695 17707 17736 E CRASH : #4 pc 00862080 /data/app/com.imagine.imagineAR-2/lib/arm/libunity.so 07-03 21:39:54.695 17707 17736 E CRASH : #5 pc 00861064 /data/app/com.imagine.imagineAR-2/lib/arm/libunity.so 07-03 21:39:54.695 17707 17736 E CRASH : #6 pc 0061f704 /data/app/com.imagine.imagineAR-2/lib/arm/libunity.so 07-03 21:39:54.695 17707 17736 E CRASH : #7 pc 0083ec0c /data/app/com.imagine.imagineAR-2/lib/arm/libunity.so 07-03 21:39:54.695 17707 17736 E CRASH : #8 pc 0083ec38 /data/app/com.imagine.imagineAR-2/lib/arm/libunity.so 07-03 21:39:54.695 17707 17736 E CRASH : #9 pc 0083edb8 /data/app/com.imagine.imagineAR-2/lib/arm/libunity.so 07-03 21:39:54.695 17707 17736 E CRASH : #10 pc 0043ec7c /data/app/com.imagine.imagineAR-2/lib/arm/libunity.so 07-03 21:39:54.695 17707 17736 E CRASH : #11 pc 004420fc /data/app/com.imagine.imagineAR-2/lib/arm/libunity.so 07-03 21:39:54.695 17707 17736 E CRASH : #12 pc 00038639 /data/app/com.imagine.imagineAR-2/oat/arm/base.odex (oatexec+4291700281) 07-03 21:39:54.695 17707 17736 E CRASH :

Am I doing something wrong? Any ideas or work arounds? Thanks in advance.

cometa93 commented 5 years ago

Are you doing something on callback received from Facebook SDK, not on the MainThread? Please make sure you don't use any UnityEngine objects from side threads.

iMagesBlues commented 5 years ago

Are you doing something on callback received from Facebook SDK, not on the MainThread? Please make sure you don't use any UnityEngine objects from side threads.

Not that I know of. This is just a direct import of the SDK to an empty Unity project. Built and ran FacebookSDK's sample scene (MainMenu.unity) on Android.

dreamolight commented 5 years ago

Have you set Facebook App ID for the project?

iMagesBlues commented 5 years ago

Yes, I have set the Facebook App ID in Facebook Settings. I have tried the new release 7.17.1 and it seems that the error on app-links is fixed, but still, I am experiencing the above crash. I have no choice but to roll back to 7.15.1 but this will be deprecated by July 22, if I'm not mistaken

iMagesBlues commented 5 years ago

Tried in Unity 2017.3.1p3 and crashing does not occur

KylinChang commented 5 years ago

Hey @iMagesBlues , that's a Unity bug in Unity2018.2 and here is the discussion https://issuetracker.unity3d.com/issues/android-crash-fatal-signal-11-sigsegv-on-some-devices?page=1#comments and adjust also has the similar issue https://github.com/adjust/unity_sdk/issues/137. We will work around and make SDK compatible with Unity2018.2

TangeloAdmin commented 5 years ago

Hi KylinChang. My app serves more than 10K monthly users. and as i read from the 22 of July the api wont work for me .... i am trying to upgrade my SDK and found issue with specific files (after 2 work days): facebook-common.aar facebook-share.aarr facebook-login.aar when bringing all the other files everything seems to work except ... i cant login to facebook. what should i do ? we have a very limited time for this upgrade and users will have to upgrade their app very soon. Thanks. Omer

iMagesBlues commented 5 years ago

Hey @iMagesBlues , that's a Unity bug in Unity2018.2 and here is the discussion https://issuetracker.unity3d.com/issues/android-crash-fatal-signal-11-sigsegv-on-some-devices?page=1#comments and adjust also has the similar issue adjust/unity_sdk#137. We will work around and make SDK compatible with Unity2018.2

Thanks @KylinChang, that would be super helpful. :) Please let us know when the fix becomes available.

leonardolanzellotti commented 5 years ago

Hey guys,

I was looking the bug-post on Unity Tracker (https://issuetracker.unity3d.com/issues/android-crash-fatal-signal-11-sigsegv-on-some-devices) and they have marked this issue as a "not reproducible"... this error is giving me some white hairs...

It's happening to me as well.. Unity 2018.2.0f + Facebook SDK 7.17 I've placed a Debug.Log on InitFacebook method only to see where the freeze occurs and I was surprised when I saw this happening exactly when I called the FB.Init() method. As I was taking a look in the logcat I was able to see my Log message. In top lines, when I push the APK to an Android version 4.2 and start it, the splash screen shows normally. Then after a Invoke of 5 seconds the FB.Init is called, then the app stop responding (buttons stop to respond) but the app doesn't crash though. In the logcat I have these messages:

D/SensorService( 514): -0.1 0.8 9.8

I/Unity ( 2833): [AtomFlu#] inicio debug

I/Unity ( 2833):

I/Unity ( 2833): (Filename: ./Runtime/Export/Debug.bindings.h Line: 43)

I/Unity ( 2833):

I/Unity ( 2833): [AtomFlu]: InitFacebook

I/Unity ( 2833):

I/Unity ( 2833): (Filename: ./Runtime/Export/Debug.bindings.h Line: 43)

I/Unity ( 2833):

D/SensorService( 514): -0.1 0.8 9.7

I/dalvikvm( 2833): Failed resolving Lcom/facebook/unity/FB$2; interface 2477 'Lcom/facebook/applinks/AppLinkData$CompletionHandler;'

W/dalvikvm( 2833): Link of class 'Lcom/facebook/unity/FB$2;' failed

E/dalvikvm( 2833): Could not find class 'com.facebook.unity.FB$2', referenced from method com.facebook.unity.FB.FetchDeferredAppLinkData

W/dalvikvm( 2833): VFY: unable to resolve new-instance 3015 (Lcom/facebook/unity/FB$2;) in Lcom/facebook/unity/FB;

D/dalvikvm( 2833): VFY: replacing opcode 0x22 at 0x002b

I/dalvikvm( 2833): Could not find method com.facebook.applinks.AppLinkData.createFromAlApplinkData, referenced from method com.facebook.unity.FB.GetAppLink

W/dalvikvm( 2833): VFY: unable to resolve static method 18605: Lcom/facebook/applinks/AppLinkData;.createFromAlApplinkData (Landroid/content/Intent;)Lcom/facebook/applinks/AppLinkData;

D/dalvikvm( 2833): VFY: replacing opcode 0x71 at 0x004f

W/dalvikvm( 2833): VFY: unable to find class referenced in signature (Lcom/facebook/applinks/AppLinkData;)

W/dalvikvm( 2833): VFY: unable to find class referenced in signature (Lcom/facebook/applinks/AppLinkData;)

W/dalvikvm( 2833): VFY: unable to find class referenced in signature (Lcom/facebook/applinks/AppLinkData;)

I/dalvikvm( 2833): Could not find method com.facebook.applinks.AppLinkData.getRef, referenced from method com.facebook.unity.FB.addAppLinkToMessage

W/dalvikvm( 2833): VFY: unable to resolve virtual method 18608: Lcom/facebook/applinks/AppLinkData;.getRef ()Ljava/lang/String;

D/dalvikvm( 2833): VFY: replacing opcode 0x6e at 0x000f

I/dalvikvm( 2833): Failed resolving Lcom/facebook/unity/FB$2; interface 2477 'Lcom/facebook/applinks/AppLinkData$CompletionHandler;'

W/dalvikvm( 2833): Link of class 'Lcom/facebook/unity/FB$2;' failed

D/dalvikvm( 2833): DexOpt: unable to opt direct call 0x5684 at 0x2d in Lcom/facebook/unity/FB;.FetchDeferredAppLinkData

W/dalvikvm( 2833): Unable to match class for part: 'Lcom/facebook/applinks/AppLinkData;)V'

E/CRASH ( 2833): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000

E/CRASH ( 2833):

E/CRASH ( 2833): Build fingerprint: 'samsung/goyawifixx/goyawifi:4.2.2/JDQ39/T110XXUANI7:user/release-keys'

E/CRASH ( 2833): Revision: '2'

E/CRASH ( 2833): pid: 2833, tid: 2863, name: UnityMain >>> com.QuatroOlhos.AtomFlu <<<

E/CRASH ( 2833): r0 00000000 r1 00000044 r2 80808080 r3 00000000

E/CRASH ( 2833): r4 60ece2c8 r5 00000000 r6 20700466 r7 409f6f91

E/CRASH ( 2833): r8 6a28bb68 r9 00000000 sl 69f8b3fc fp 60ece300

E/CRASH ( 2833): ip 60bf9cdc sp 60ece270 lr 5fb2f388 pc 400b3b88 cpsr 60ecdf00

E/CRASH ( 2833):

E/CRASH ( 2833): backtrace:

E/CRASH ( 2833): #00 pc 00019b88 /system/lib/libc.so (strlen+72)

E/CRASH ( 2833): #01 pc 00122384 /data/app-lib/com.QuatroOlhos.AtomFlu-11/libunity.so

E/CRASH ( 2833): #02 pc 00127464 /data/app-lib/com.QuatroOlhos.AtomFlu-11/libunity.so

E/CRASH ( 2833): #03 pc 0000b944 ( (wrapper managed-to-native) UnityEngine.AndroidJNI:CallStaticStringMethod (intptr,intptr,UnityEngine.jvalue[]) + 0x4c (0x6a1b48f8 0x6a1b4988) [0x61461ee0 - Unity Root Domain]+47428)

E/CRASH ( 2833): #04 il ........ at (wrapper managed-to-native) UnityEngine.AndroidJNI.CallStaticStringMethod (intptr,intptr,UnityEngine.jvalue[]) <0xffffffff>

E/CRASH ( 2833): #05 il 0000002c at UnityEngine.AndroidJNISafe.CallStaticStringMethod (intptr,intptr,UnityEngine.jvalue[]) <0x0002c>

E/CRASH ( 2833): #06 il 0000042b at UnityEngine.AndroidJavaObject._CallStatic (string,object[]) <0x0042b>

E/CRASH ( 2833): #07 il 0000003b at UnityEngine.AndroidJavaObject.CallStatic (string,object[]) <0x0003b>

E/CRASH ( 2833): #08 il 0000005f at Facebook.Unity.Android.AndroidWrapper.CallStatic (string) <0x0005f>

E/CRASH ( 2833): #09 il 0000005b at Facebook.Unity.Mobile.Android.AndroidFacebook..ctor (Facebook.Unity.Mobile.Android.IAndroidWrapper,Facebook.Unity.CallbackManager) <0x0005b>

E/CRASH ( 2833): #10 il 0000003f at Facebook.Unity.Mobile.Android.AndroidFacebook..ctor () <0x0003f>

E/CRASH ( 2833): #11 il 0000004f at Facebook.Unity.Mobile.Android.AndroidFacebookLoader.get_FBGameObject () <0x0004f>

E/CRASH ( 2833): #12 il 00000023 at Facebook.Unity.FB/CompiledFacebookLoader.Start () <0x00023>

E/CRASH ( 2833): #13 il 0000006b at (wrapper runtime-invoke) object.runtime_invoke_voidthis (object,intptr,intptr,intptr) <0x0006b>

If I comment the FB.Init call, my app works properly.

Someone give me a help?

iMagesBlues commented 5 years ago

@leonardolanzellotti, I believe the devs are already aware of this error. It only occurs on Unity 2018.2. We can either wait for the fix in the upcoming release or upgrade our Unity version. I believe @KylinChang will give us updates in this thread :)

carmatija commented 5 years ago

Any news on this? We are having a problem because of google 64bit requrement, and FB is stopping us from updating our project to IL2CPP and .Net4. Before changing to IL2CPP and .net4, FB worked fine. Removing FB.Init() fixes the crash.

We added Debug.Logs before and after FB.Init(), and both logs are printed. But InitCallback is never called.

Crash happens on Unity 2018.2.0f2 and FB plugin 7.17.2 on all test devices we have. Even on sample project (empty Unity project + FB 7.17.2).

KylinChang commented 5 years ago

Hey @carmatija , as mentioned above, this is an issue of Unity2018, temporary solution is to use another version of Unity Editor.

carmatija commented 5 years ago

Hey @carmatija , as mentioned above, this is an issue of Unity2018, temporary solution is to use another version of Unity Editor.

Do you have any timeline on when this will be fixed in SDK? So we can plan our future releases based on that.

MirHamzaHasan commented 4 years ago

I am facing the same on unity 2017.4.22 I think its due to x64 bit support when we remove it. Issue go away :(

R0B0T-080 commented 4 years ago

Hi there, I might have a workaround for you.

We are on Unity 5.6.7f1 / Facebook v7.19.0, and had the same crash, although not at FB.Init but at FB.API.

What I did:

  1. I called FB.Init right after the game starts.
  2. I called FB.API right after the initialization completes.

The occurrence of the crash was not consistent (80% the time), so I guessed it had something to do with Unity's startup process. Therefore I moved the call of FB.API to later time, when the scene was already loaded. This seems to do the work, the FB.API callback is not crashing any more.

If you are still having the crash right at FB.Init with your Unity version, try to call it first when the scene is already started. Maybe delayed Invoke or coroutine can help here as well.

rodolforubens commented 3 years ago

I'm facing this in 2019.4.7f1 as well, not a 2018 thing.