# Facebook extension crashes on Android

**URL:** <https://forum.defold.com/t/facebook-extension-crashes-on-android/56599>\
**Category:** Questions\
**Created:** [July 3, 2019, 5:13pm UTC](https://forum.defold.com/t/facebook-extension-crashes-on-android/56599 "2019-07-03T17:13:22Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![\_thegrizzlybear](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/_thegrizzlybear/32/19764_2.png) [@\_thegrizzlybear](https://forum.defold.com/u/_thegrizzlybear)\
**Post date:** [July 3, 2019, 5:13pm UTC](https://forum.defold.com/t/facebook-extension-crashes-on-android/56599/1 "2019-07-03T17:13:22Z")

</div>

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: [Facebook in Defold](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:

```lua
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

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [July 3, 2019, 5:37pm UTC](https://forum.defold.com/t/facebook-extension-crashes-on-android/56599/2 "2019-07-03T17:37:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![\_thegrizzlybear](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/_thegrizzlybear/32/19764_2.png) [@\_thegrizzlybear](https://forum.defold.com/u/_thegrizzlybear)\
**Post date:** [July 3, 2019, 5:39pm UTC](https://forum.defold.com/t/facebook-extension-crashes-on-android/56599/3 "2019-07-03T17:39:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![\_thegrizzlybear](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/_thegrizzlybear/32/19764_2.png) [@\_thegrizzlybear](https://forum.defold.com/u/_thegrizzlybear)\
**Post date:** [July 3, 2019, 5:44pm UTC](https://forum.defold.com/t/facebook-extension-crashes-on-android/56599/4 "2019-07-03T17:44:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![AGulev](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/agulev/32/4541_2.png) [@AGulev](https://forum.defold.com/u/AGulev)\
**Post date:** [July 3, 2019, 5:47pm UTC](https://forum.defold.com/t/facebook-extension-crashes-on-android/56599/5 "2019-07-03T17:47:04Z")

</div>

At the moment now the recommended stable version is 1.4:

> **[Release Added minSdkVersion=9 to Android manifest · defold/extension-facebook](https://github.com/defold/extension-facebook/releases/tag/v1.4)**
>
> Facebook extension using the official SDKs. Contribute to defold/extension-facebook development by creating an account on GitHub.

> [https://github.com/defold/extension-facebook/archive/v1.4.zip](https://github.com/defold/extension-facebook/archive/v1.4.zip)

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [July 3, 2019, 6:25pm UTC](https://forum.defold.com/t/facebook-extension-crashes-on-android/56599/6 "2019-07-03T18:25:24Z")

</div>

> [@\_thegrizzlybear](#):
>
> It just crashes.

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

---

<div class="post-metadata">

**Author:** ![\_thegrizzlybear](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/_thegrizzlybear/32/19764_2.png) [@\_thegrizzlybear](https://forum.defold.com/u/_thegrizzlybear)\
**Post date:** [July 3, 2019, 8:58pm UTC](https://forum.defold.com/t/facebook-extension-crashes-on-android/56599/7 "2019-07-03T20:58:53Z")

</div>

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)

```

---

<div class="post-metadata">

**Author:** ![AGulev](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/agulev/32/4541_2.png) [@AGulev](https://forum.defold.com/u/AGulev)\
**Post date:** [July 3, 2019, 9:01pm UTC](https://forum.defold.com/t/facebook-extension-crashes-on-android/56599/8 "2019-07-03T21:01:38Z")

</div>

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:

> [@Defold 1.2.157 has been released](https://forum.defold.com/t/defold-1-2-157-has-been-released/55935/17):
>
> Just a quick update, I’m looking into the issues with bundle resources on Android. If it’s a blocker for you, please use previously released editor (1.2.156) while we work on a fix: macOS: [http://d.defold.com/archive/67b68f1e1ac26a3385fb511cdce520fe52387bb0/stable/editor2/Defold-x86\_64-darwin.dmg](http://d.defold.com/archive/67b68f1e1ac26a3385fb511cdce520fe52387bb0/stable/editor2/Defold-x86_64-darwin.dmg) Windows: [http://d.defold.com/archive/67b68f1e1ac26a3385fb511cdce520fe52387bb0/stable/editor2/Defold-x86\_64-win32.zip](http://d.defold.com/archive/67b68f1e1ac26a3385fb511cdce520fe52387bb0/stable/editor2/Defold-x86_64-win32.zip) Linux: [http://d.defold.com/archive/67b68f1e1ac26a3385fb511cdce520fe52387bb0/stable…](http://d.defold.com/archive/67b68f1e1ac26a3385fb511cdce520fe52387bb0/stable/editor2/Defold-x86_64-linux.zip)

---

<div class="post-metadata">

**Author:** ![\_thegrizzlybear](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/_thegrizzlybear/32/19764_2.png) [@\_thegrizzlybear](https://forum.defold.com/u/_thegrizzlybear)\
**Post date:** [July 3, 2019, 9:03pm UTC](https://forum.defold.com/t/facebook-extension-crashes-on-android/56599/9 "2019-07-03T21:03:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![\_thegrizzlybear](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/_thegrizzlybear/32/19764_2.png) [@\_thegrizzlybear](https://forum.defold.com/u/_thegrizzlybear)\
**Post date:** [July 3, 2019, 9:12pm UTC](https://forum.defold.com/t/facebook-extension-crashes-on-android/56599/10 "2019-07-03T21:12:10Z")

</div>

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

Thank you all again!

---

<div class="post-metadata">

**Author:** ![AGulev](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/agulev/32/4541_2.png) [@AGulev](https://forum.defold.com/u/AGulev)\
**Post date:** [July 3, 2019, 9:15pm UTC](https://forum.defold.com/t/facebook-extension-crashes-on-android/56599/11 "2019-07-03T21:15:25Z")

</div>

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

> [@Defold 1.2.157 has been released](https://forum.defold.com/t/defold-1-2-157-has-been-released/55935/21):
>
> An update regarding the issue with bundling Android from Windows (#4215): We have a fix ready and will probably release a new stable in a few days that includes this fix and a few more bug fixes.
