thank you so much “pandamicro” i solved it.
anyone have the same problem you need to import jsb_plugin.js .
Note : you just need to retype your code correctly .
Add the following lines in your ProjectRoot/frameworks/runtime-src/proj.android/jni/Android.mk.
LOCAL_WHOLE_STATIC_LIBRARIES += jsb_pluginx_static
$(call import-module,cocos2d-x/plugin/jsbindings)
Here’s the sample of that.
LOCAL_STATIC_LIBRARIES := cocos_jsb_static
LOCAL_WHOLE_STATIC_LIBRARIES += jsb_pluginx_static
LOCAL_EXPORT_CFLAGS := -DCOCOS2D_DEBUG=2 -DCOCOS2D_JAVASCRIPT
include $(BUILD_SHARED_LIBRARY)
$(call import-module,bindings)
$(call import-module,cocos2d-x/plugin/jsbindings)
NextStep. Now in the same jni directory i.e. ProjectRoot/frameworks/runtime-src/proj.android/jni/ you will find hellojavascript/main.cpp
Add the import lines at the top
#include “PluginJniHelper.h”
Add the following code under cocos_app_init function
JavaVM* vm;
env->GetJavaVM(&vm);
PluginJniHelper::setJavaVM(vm);
your function should look like this
void cocos_android_app_init (JNIEnv* env, jobject thiz) {
LOGD("cocos_android_app_init");
AppDelegate *pAppDelegate = new AppDelegate();
JavaVM* vm;
env->GetJavaVM(&vm);
PluginJniHelper::setJavaVM(vm);
}
NextStep. Now go to this directory ProjectRoot/frameworks/runtime-src/Classes/AppDelegate.cpp
Add the following code at the top to #include the two files
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
#include “jsb_cocos2dx_pluginx_auto.hpp”
#include “jsb_pluginx_extension_registration.h”
#endif
This is very important step , see the below code which you need to add inside the function
bool AppDelegate::applicationDidFinishLaunching() but remember to add before js_register as shown below.
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
sc->addRegisterCallback(register_all_pluginx_protocols);
sc->addRegisterCallback(register_pluginx_js_extensions);
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
sc->addRegisterCallback(JavascriptJavaBridge::_js_register);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS|| CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
sc->addRegisterCallback(JavaScriptObjCBridge::_js_register);
#endif
NextStep. Add the following lines in the ProjectRoot/frameworks/runtime-src/proj.android/build-cg.json
basically copy the protocols src and googlelPlay src to the project
“copy_resources”: [
{
“from”: “…/…/…/src”,
“to”: “src”
},
{
“from”: “…/…/…/res”,
“to”: “res”
},
{
“from”: “…/…/…/main.js”,
“to”: “”
},
{
“from”: “…/…/js-bindings/cocos2d-x/plugin/jsbindings/script”,
“to”: “”
},
{
“from”: “…/…/js-bindings/cocos2d-x/plugin/protocols/proj.android/src”,
“to”: “…/src”
},
{
“from”: “…/…/js-bindings/cocos2d-x/plugin/plugins/facebook/proj.android/src”,
“to”: “…/src”
},
{
“from”: “…/…/js-bindings/cocos2d-x/plugin/plugins/facebook/proj.android/sdk”,
“to”: “…/libs”
}
],
what i wrote here not fully steps , but important to retype
but anyone need full steps please refer to this link
http://www.cocos2d-x.org/wiki/Integrate_Facebook_SDK_on_Android