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?
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.
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)