grago
August 21, 2014, 10:51pm
#1
Hello there, i’m new here, i’m trying to take my first steps in Cocos2d-js and i want to try the Facebook SDK for use with web and native platforms, since this is key to what i want to work on.
I’ve setup a new project using Facebook SDK following these instructions
However when running my code i get this error on console:
load json [frameworks/cocos2d-html5/moduleConfig.json] failed : TypeError: 'null' is not an object (evaluating 'canvasNode.style')
Removing the Facebook plugin references on the project.json file solves the problem, but of course the Facebook plugin won’t work.
What could be the cause of the problem? Thanks in advance
grago
August 21, 2014, 11:22pm
#2
Nevermind, it just worked! I think it was some sort of typo or copy/paste problem. I was able to login with Facebook and publish actions
grago
August 22, 2014, 4:28am
#4
Thanks! Now i’m trying to make it work on Android platform. However wen running cocos compile -p android i get the following:
[armeabi] Compile++ thumb: cocos2djs_shared <= main.cpp jni/hellojavascript/main.cpp:6:29: fatal error: PluginJniHelper.h: No such file or directory
I followed instructions on this page
Is anything i could be doing wrong?
Thanks in advance
@grago
What version of you are using cocos2d-js?
Facebook SDK Is the latest addition.
You can try check the moduleConfig.json there is no plugin-facebook…
Thanks~~ ^.^
VisualSJ
grago
August 22, 2014, 3:44pm
#6
Hello VisualSJ, thanks for your answer. I’m using Cocos2d-js 3.0 RC2. In fact i was able to make Facebook work on web platform, but it won’t compile on Android because of the PluginJniHelper.h error. I looked into moduleConfig.json and the “plugin-facebook” entry is there. Thanks!
Hi, @grago !
Did you add Add Plugin-x lib to frameworks/runtime-src/proj.android/jni/Android.mk
?
LOCAL_WHOLE_STATIC_LIBRARIES += jsb_pluginx_static
$(call import-module,cocos2d-x/plugin/jsbindings)
grago
August 25, 2014, 4:51pm
#8
Hello Joshua, yes i’ve added it to the bottom of the Android.mk file, here is the full contents of the file:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := cocos2djs_shared
LOCAL_MODULE_FILENAME := libcocos2djs
LOCAL_SRC_FILES := hellojavascript/main.cpp \
../../Classes/AppDelegate.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes
LOCAL_WHOLE_STATIC_LIBRARIES := cocos_jsb_static
LOCAL_WHOLE_STATIC_LIBRARIES += jsb_chipmunk_static
LOCAL_WHOLE_STATIC_LIBRARIES += jsb_extension_static
LOCAL_WHOLE_STATIC_LIBRARIES += jsb_localstorage_static
LOCAL_WHOLE_STATIC_LIBRARIES += jsb_ui_static
LOCAL_WHOLE_STATIC_LIBRARIES += jsb_studio_static
LOCAL_WHOLE_STATIC_LIBRARIES += jsb_network_static
LOCAL_WHOLE_STATIC_LIBRARIES += jsb_builder_static
LOCAL_WHOLE_STATIC_LIBRARIES += jsb_spine_static
LOCAL_EXPORT_CFLAGS := -DCOCOS2D_DEBUG=2 -DCOCOS2D_JAVASCRIPT
include $(BUILD_SHARED_LIBRARY)
$(call import-module,bindings)
$(call import-module,bindings/manual/chipmunk)
$(call import-module,bindings/manual/extension)
$(call import-module,bindings/manual/localstorage)
$(call import-module,bindings/manual/network)
$(call import-module,bindings/manual/cocosbuilder)
$(call import-module,bindings/manual/ui)
$(call import-module,bindings/manual/cocostudio)
$(call import-module,bindings/manual/spine)
LOCAL_WHOLE_STATIC_LIBRARIES += jsb_pluginx_static
$(call import-module,cocos2d-x/plugin/jsbindings)
Thanks!
saiy2k
March 13, 2015, 12:10pm
#9
I am having the PluginJnIHelper.h No such file or directory
issue with JS v3.3.
Was following the steps in this link: http://www.cocos2d-x.org/docs/manual/framework/html5/facebook-sdk/facebook-sdk-on-android/en
Android NDK: WARNING: APP_PLATFORM android-19 is larger than android:minSdkVersion 9 in ./AndroidManifest.xml
Android NDK: WARNING:/Users/saiy2k/projects/iDiwali2.0/frameworks/runtime-src/proj.android/../../js-bindings/cocos2d-x/plugin/protocols/proj.android/jni/Android.mk:PluginProtocolStatic: LOCAL_LDLIBS is always ignored for static libraries
make: Entering directory `/Users/saiy2k/projects/iDiwali2.0/frameworks/runtime-src/proj.android'
[armeabi] Gdbserver : [arm-linux-androideabi-4.9] libs/armeabi/gdbserver
[armeabi] Gdbsetup : libs/armeabi/gdb.setup
[armeabi] Compile++ thumb: cocos2djs_shared <= main.cpp
jni/hellojavascript/main.cpp:6:29: fatal error: PluginJniHelper.h: No such file or directory
#include "PluginJniHelper.h"
^
compilation terminated.
make: *** [obj/local/armeabi/objs-debug/cocos2djs_shared/hellojavascript/main.o] Error 1
make: Leaving directory `/Users/saiy2k/projects/iDiwali2.0/frameworks/runtime-src/proj.android'
Any help?