Facebook extension crashes on Android

Hello,

I’ve been trying to get the Facebook extension to work on Android, but it crashes on the login function. I’m bundling the build in a Windows machine. In iOS, it seems to be working well.

I’ve followed this manual: https://www.defold.com/manuals/facebook/ to set it up.
I’ve got my key hash in, and for Class Name, I’ve put “com.dynamo.android.DefoldActivity”.
In the editor side of things, I just added the App Id into the Facebook section of game.project.

I also tested this on a clean project, and it’s crashing too. No logcat information about the crash.

This is the code I’m using:

local permissions = { "publish_to_groups" }
facebook.login_with_publish_permissions(permissions, facebook.AUDIENCE_EVERYONE, function(self, data)
		if (data.status == facebook.STATE_OPEN and data.error == nil) then
				print("Successfully logged into Facebook")
			else
				print("Failed to get permissions (" .. data.status .. ")")
			end
		end)

Did I set things up wrong? Am I missing something?

Thank you

What error message do you get?
What extension version are you using?

I’m not getting any error messages. It just crashes.
And I’m using the latest one from the github (master).

I don’t know if this helps, but instead of using the login function, I tried using the show_dialog function.
It still crashed, but before it did, it told me I was not logged in.

At the moment now the recommended stable version is 1.4:

https://github.com/defold/extension-facebook/archive/v1.4.zip

Ok, and if you get the log from the Android device, what does it say?
E.g. using adb logcat

Using the 1.4 version still crashes!

This is the log:

07-03 13:56:16.468 26072 26072 E AndroidRuntime: java.lang.NoSuchFieldError: No static field com_facebook_activity_layout of type I in class Lcom/facebook/R$layout; or its superclasses (declaration of 'com.facebook.R$layout' appears in /data/app/com.zeppeln.slimedefense-A9XUE5-WvkPNkw-aEkBWeQ==/base.apk)
07-03 13:56:16.468 26072 26072 E AndroidRuntime:        at com.facebook.FacebookActivity.onCreate(FacebookActivity.java:58)
07-03 13:56:16.468 26072 26072 E AndroidRuntime:        at android.app.Activity.performCreate(Activity.java:7783)
07-03 13:56:16.468 26072 26072 E AndroidRuntime:        at android.app.Activity.performCreate(Activity.java:7772)
07-03 13:56:16.468 26072 26072 E AndroidRuntime:        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299)
07-03 13:56:16.468 26072 26072 E AndroidRuntime:        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3235)
07-03 13:56:16.468 26072 26072 E AndroidRuntime:        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3396)
07-03 13:56:16.468 26072 26072 E AndroidRuntime:        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
07-03 13:56:16.468 26072 26072 E AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
07-03 13:56:16.468 26072 26072 E AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
07-03 13:56:16.468 26072 26072 E AndroidRuntime:        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2009)
07-03 13:56:16.468 26072 26072 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:107)
07-03 13:56:16.468 26072 26072 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:214)
07-03 13:56:16.468 26072 26072 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:7319)
07-03 13:56:16.468 26072 26072 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
07-03 13:56:16.468 26072 26072 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
07-03 13:56:16.468 26072 26072 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:934)

What version of Defold do you using?

We have an issue with bundling on windows in 1.2.157 for Android, could you check this topic please:

1 Like

I am using 1.2.157. I will try using the previous one and report back.
Thanks!

1 Like

That did the trick! The extension is working properly and does not crash on 1.2.156.

Thank you all again!

1 Like

Sorry for the inconvenience. We are working on the hotfix build:

2 Likes