[SOLVED] Facebook plugin crashes on login calls

I’ve added Facebook plugin manually and carefully (Android, cocos2d-x 3.6, sdkbox+facebook 1.2.1). It compiles without problems, however when I call sdkbox::PluginFacebook::login() or sdkbox::PluginFacebook::isLoggedIn() the app crashes with the following ndk-stack traces:

pid: 3136, tid: 3153, name: GLThread 252 >>> com.example.myapp <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x4
Stack frame #00 pc 003fa843 /data/app/com.example.myapp-2/lib/x86/libcocos2dcpp.so (sdkbox::FacebookProxy::logInWithReadPermissions(std::vector<std::string, std::allocatorstd::string > const&, int)+307)
Stack frame #01 pc 003fc61a /data/app/com.example.myapp-2/lib/x86/libcocos2dcpp.so (sdkbox::PluginFacebook::login()+90)
Stack frame #02 pc 003e23db /data/app/com.example.myapp-2/lib/x86/libcocos2dcpp.so
Stack frame #03 pc 003e3374 /data/app/com.example.myapp-2/lib/x86/libcocos2dcpp.so
Stack frame #04 pc 0042ee0c /data/app/com.example.myapp-2/lib/x86/libcocos2dcpp.so (std::function<void (cocos2d::Ref*, cocos2d::ui::Widget::TouchEventType)>::operator()(cocos2d::Ref*, cocos2d::ui::Widget::TouchEventType) const+88)
Stack frame #05 pc 0042c932 /data/app/com.example.myapp-2/lib/x86/libcocos2dcpp.so (cocos2d::ui::Widget::releaseUpEvent()+82)

Or

pid: 3973, tid: 3990, name: GLThread 297 >>> com.example.myapp <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x4
Stack frame #00 pc 00401464 /data/app/com.example.myapp-1/lib/x86/libcocos2dcpp.so (sdkbox::FacebookProxy::getAccessToken() const+36)
Stack frame #01 pc 004014b5 /data/app/com.example.myapp-1/lib/x86/libcocos2dcpp.so (sdkbox::FacebookProxy::isLoggedIn() const+37)
Stack frame #02 pc 003ffcdd /data/app/com.example.myapp-1/lib/x86/libcocos2dcpp.so (sdkbox::PluginFacebook::isLoggedIn()+29)
Stack frame #03 pc 003dccf5 /data/app/com.example.myapp-1/lib/x86/libcocos2dcpp.so
Stack frame #04 pc 003ddc9c /data/app/com.example.myapp-1/lib/x86/libcocos2dcpp.so
Stack frame #05 pc 004241ce /data/app/com.example.myapp-1/lib/x86/libcocos2dcpp.so (std::function<void (cocos2d::Ref*, cocos2d::ui::Widget::TouchEventType)>::operator()(cocos2d::Ref*, cocos2d::ui::Widget::TouchEventType) const+88)

I do call:

sdkbox::PluginFacebook::init();
sdkbox::PluginFacebook::setListener(FacebookListener::GetInstance());

earlier in the code, however, unlike from Google Analytics or IAP plugins, I can’t see any log messages from the Facebook plugin in logcat on init(). Both GAnalytics and IAP are working well in the same app. Any hints what might be wrong very appreciated.

We’ll look into that.

At the meantime, can you try SDKBOX Facebook sample and see if it crashes on your device as well.

Thank you @nite for the hint. The sample package runs well, although compiling it was a bit struggle. I couldn’t setup it properly in Eclipse, so i ran the cocos_build.py from a console. I had to change target API from GoogleAPIs-21 to Android-21. There was also the following minor error:

[armeabi] Compile++ thumb: cocos2dcpp_shared <= HelloWorldScene.cpp
jni/…/…/Classes/HelloWorldScene.cpp:4:43: fatal error: PluginFacebook/PluginFacebook.h: No such file or directory
#include “PluginFacebook/PluginFacebook.h”
^
compilation terminated.

(I don’t know why the include is PluginFacebook/PluginFacebook.h in docs and in the sample project, whereas for me only pluginfacebook/PluginFacebook.h works. Exactly same story with PluginGoogleAnalytics and PluginIap.)

So the sample works both on device/release/armeabi and emulator/debug/x86 (I mean the facebook login window appears, without crash). I need to find out what makes the difference and why the plugin doesn’t work with my app.

I’ve managed to get my app working. I’m not sure what was causing the problem, so much tweaking has been done to resolve this, but possibly it was just a typo in sdkbox_config.json

I have the same problem compiling for android platform on Linux, but it’s work correctly on IOS, for android platform, very strange

Hello @gontar

May we please ask you to edit the thread name with prefix [SOLVED], as that would help us to track.

Best,
Pabitra