Expo.Facebook works within EXP, error in Standalone APK

I’m working on a react-native app, on top of exp, has been fully tested using exp start and it is working end to end, as expected.

The facebook login works perfectly (within the exp start), and the code that does it:

const appId = "XXXXXX"; 
const permissions = ['public_profile', 'email', 'user_friends']; 
const options = { permissions: permissions };
const {type, token} = await Expo.Facebook.logInWithReadPermissionsAsync(appId, options);

The prolem is, for the same Android Device:

  • It runs perfectly when we use exp start .

  • It doesn’t work at all when we open the standalone app built with exp build:android and I get a blank screen of death right after I click the facebook button.

I used logcat to extract the logs from and android phone trying to run the app. Logs are quite verbose, but I managed to exert what I believe to be the cause:

10-21 09:55:09.033  2542  7477 E ActivityManager: Sending non-protected broadcast com.motorola.motocare.INTENT_TRIGGER from system 4355:com.motorola.process.system/1000 pkg com.motorola.motgeofencesvc

10-21 09:55:09.033  2542  7477 E ActivityManager: java.lang.Throwable

10-21 09:55:09.033  2542  7477 E ActivityManager: 	at com.android.server.am.ActivityManagerService.broadcastIntentLocked(ActivityManagerService.java:18226)

10-21 09:55:09.033  2542  7477 E ActivityManager: 	at com.android.server.am.ActivityManagerService.broadcastIntent(ActivityManagerService.java:18826)

10-21 09:55:09.033  2542  7477 E ActivityManager: 	at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:512)

10-21 09:55:09.033  2542  7477 E ActivityManager: 	at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2906)

10-21 09:55:09.033  2542  7477 E ActivityManager: 	at android.os.Binder.execTransact(Binder.java:565)

10-21 09:55:09.051  2542  4397 E ActivityManager: Sending non-protected broadcast com.motorola.motocare.INTENT_TRIGGER from system 4355:com.motorola.process.system/1000 pkg com.motorola.motgeofencesvc

10-21 09:55:09.051  2542  4397 E ActivityManager: java.lang.Throwable

10-21 09:55:09.051  2542  4397 E ActivityManager: 	at com.android.server.am.ActivityManagerService.broadcastIntentLocked(ActivityManagerService.java:18226)

10-21 09:55:09.051  2542  4397 E ActivityManager: 	at com.android.server.am.ActivityManagerService.broadcastIntent(ActivityManagerService.java:18826)

10-21 09:55:09.051  2542  4397 E ActivityManager: 	at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:512)

10-21 09:55:09.051  2542  4397 E ActivityManager: 	at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2906)

10-21 09:55:09.051  2542  4397 E ActivityManager: 	at android.os.Binder.execTransact(Binder.java:565)

10-21 09:55:09.079 12213 12213 E g       : java.lang.ClassNotFoundException: abi19_0_0.com.facebook.soloader.SoLoader

10-21 09:55:09.080 12213 12213 E g       : Runtime exception in RNObject: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.reflect.Method[] java.lang.Class.getMethods()' on a null object reference

10-21 09:55:09.116 12213 12380 I RegistrationIntentService: GCM Registration Token: eGc32VkupXw:APA91bHj87lbQqMvfJ-dtnFMHco9ZDhk1Eq2G28h2BgKBR8sZ24xZrjGw1oeZGbZerHsxXCakjYz-YNwpSGMh0ozKwbBV3LhbXszZ-DNjgOWmQypmzIc5sOoC4_vExtDnNet9Yqoq9Re

10-21 09:55:09.304  2542  2897 I WindowManager: Destroying surface Surface(name=br.com.miredefamilia/com.facebook.FacebookActivity) called by com.android.server.wm.WindowStateAnimator.destroySurface:2067 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:896 com.android.server.wm.WindowState.destroyOrSaveSurface:2094 com.android.server.wm.AppWindowToken.destroySurfaces:363 com.android.server.wm.WindowStateAnimator.finishExit:575 com.android.server.wm.AppWindowAnimator.stepAnimationLocked:438 com.android.server.wm.WindowAnimator.updateAppWindowsLocked:196 com.android.server.wm.WindowAnimator.animateLocked:678

It feels pretty obvious to me that this Runtime exception in RNObject: java.lang.NullPointerException is the culprit and that the Destroying surface Surface(name=br.com.miredefamilia/com.facebook.FacebookActivity) that comes right after is the source of the blank screen I get as a result.

EDIT 1, HASH and KEYTOOL

After @bennygenel’s contribution:

Just to check; did you run the keytool command given here and added the key to facebook app? I’m not sure whats really wrong but I can only suggest you to check and confirm that all the values are correct (package name, keys etc.)

I have already setup the hash in the facebook developer console. I tried to generate the hash with the keytool like suggested by the expo documentation.

No luck on that too - initially FB was actually complaining that the hash didn’t match with the one I generated using the keytool and gave me the “hash” that the app was trying to use. I included this key exposed by FB and it has passed that point.

However, past this exact point, I got the blank screen that I’m fighting against in this post.

EDIT 2, Affects exp publish as well

  • The tests I performed before was in exp start . --tunnel

  • When using exp publish, it failed exactly the same way, blank screen of death

Just found out it affects IOS

EDIT 3, Affects IOS too

  • Just found out it affects IOS

Versions:

  • React: 16-alpha12
  • Expo: SDK-19

Any ideas?