Crash at facebook.login on Android (DEF-1647)

I’ve followed the Defold facebook manual to setup FB functionalities in my Android game.
When I bundle release version of my app and use facebook.login(fb_callback) I get a toast “Unfortunately, app MyAppName has stopped”. I also tried to install my app from Google Play - it still crashes.

In logcat I found:

03-02 19:49:22.570: V/WindowManager(494): Changing focus from Window{41a772f0 u0 Application Error: com.my.package.name EXITING} to Window{41a52018 u0 com.my.package.name/com.dynamo.android.DispatcherActivity}
03-02 19:49:22.574: I/WindowManager(494): Gaining focus: Window{41a52018 u0 com.my.package.name/com.dynamo.android.DispatcherActivity}
03-02 19:49:22.647: D/IPCThreadState(494): [DN #5] BR_DEAD_BINDER cookie 0x57ce1578
03-02 19:49:22.647: D/IPCThreadState(494): [DN #5] BR_DEAD_BINDER cookie 0x5528cbe8
03-02 19:49:22.648: D/IPCThreadState(494): [DN #5] BR_DEAD_BINDER cookie 0x567ff310
03-02 19:49:22.648: V/ActivityManager(494): Death received in com.android.server.am.ActivityManagerService$AppDeathRecipient@41a269e0 for thread android.os.BinderProxy@41a44ef8
03-02 19:49:22.648: I/ActivityManager(494): Process com.my.package.name (pid 15289) has died.

When I run my appliaction through dmengine.apk I don’t get crash, but also I cannot login to FB account - I get an information that this aplication is not yet configured and that it is still in development mode. I guess it is because I’m actually running dmengine.apk instead of my app directly (the Caveats section from the FB manual).

My app is on Google Play store already, but still in closed testing phase (not yet released to public)

Any thoughts why it crashes?

And if you print() just before, after and in the callback to facebook.login() you only see the print() before the call to facebook.login() in logcat? Could you post your facebook.login() code?

Hm, did you bundle for Android on a Windows machine? I have run into something similar before, trying to chase it down but would help to know what platform you are bundling on.

Thanks for the reply guys!

@sven
Yes, I’m bundling on 64 bit Windows 10.

@britzl
I can see the log even after the call, but I’m sure it is caused by it, because if I remove it then the app is not crashing.
The code around facebook.login:

function on_input(self, action_id, action)
  local select = action_id == hash("select") and action.pressed
 if select or (action_id == hash("click") and action.pressed) then
    if select or gui.pick_node(gui.get_node("new_game"), action.x, action.y) then
      gui.animate(gui.get_node("death_menu"), "color", vmath.vector4(1.0, 1.0, 1.0, 0.0), gui.EASING_LINEAR, 1.0, 0.0, game_over_faded_out)
    elseif gui.pick_node(gui.get_node("death_share"), action.x, action.y) then
      gui.set_color(gui.get_node("death_share"), vmath.vector3(0.0, 0.0, 1.0))
      print("Before FB Login")
      facebook.login(fb_login)
      print("After FB Login")
    end
  elseif action_id == hash("back") and action.pressed then
    msg.post("default:/scene_manager", "perform_loading",
      {
        scenes_to_load = {msg.url("default:/menu#menu_collection_proxy")},
        scenes_to_unload = {msg.url("default:/ocean#ocean_collection_proxy"), msg.url("default:/game_over#game_over_collection_proxy")}
    })
  end
end

And the facebook login callback:

function fb_login(self, status, error)
  print("FB Login Callback")
  if error or status ~= facebook.STATE_OPEN then
    print("failed to login to facebook")
    gui.set_color(gui.get_node("death_share"), vmath.vector3(1.0, 0.0, 0.0))
    return
  else
    print("Logged in facebook")
    gui.set_color(gui.get_node("death_share"), vmath.vector3(0.0, 1.0, 0.0))
  end
end

Today I’ve prepared debug build to see the logs in the logcat and I’ve managed to find the callstack:

E/AndroidRuntime(20957): FATAL EXCEPTION: main
E/AndroidRuntime(20957): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.followthewhiterabit.thewhale/com.facebook.FacebookActivity}: java.lang.IllegalArgumentException: No view found for id 0x7f050016 (com.followthewhiterabit.thewhale:string/auth_client_needs_installation_title) for fragment LoginFragment{413592a0 #0 id=0x7f050016 SingleFragment}
E/AndroidRuntime(20957):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2343)
E/AndroidRuntime(20957):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2395)
E/AndroidRuntime(20957):     at android.app.ActivityThread.access$600(ActivityThread.java:162)
E/AndroidRuntime(20957):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
E/AndroidRuntime(20957):     at android.os.Handler.dispatchMessage(Handler.java:107)
E/AndroidRuntime(20957):     at android.os.Looper.loop(Looper.java:194)
E/AndroidRuntime(20957):     at android.app.ActivityThread.main(ActivityThread.java:5371)
E/AndroidRuntime(20957):     at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(20957):     at java.lang.reflect.Method.invoke(Method.java:525)
E/AndroidRuntime(20957):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
E/AndroidRuntime(20957):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
E/AndroidRuntime(20957):     at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(20957): Caused by: java.lang.IllegalArgumentException: No view found for id 0x7f050016 (com.followthewhiterabit.thewhale:string/auth_client_needs_installation_title) for fragment LoginFragment{413592a0 #0 id=0x7f050016 SingleFragment}
E/AndroidRuntime(20957):     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:919)
E/AndroidRuntime(20957):     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
E/AndroidRuntime(20957):     at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
E/AndroidRuntime(20957):     at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1467)
E/AndroidRuntime(20957):     at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:570)
E/AndroidRuntime(20957):     at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1167)
E/AndroidRuntime(20957):     at android.app.Activity.performStart(Activity.java:5132)
E/AndroidRuntime(20957):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2316)
E/AndroidRuntime(20957):     ... 11 more
1 Like

Thank you!

This seems to be the same problem I have been looking into, I’m attaching the issue DEF-1647. I might have a solution for it, in testing now, but I can’t promise if it will make it in time for next release!

1 Like