I cant build project after import facebook plugin

I just got this error when build project after i import facebook with sdkbox.
p/s : build project everthing okay if it is new project, but cant build after import facebook plugin

Someone help me please :((

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:testFB:externalNativeBuildDebug’.

Build command failed.
Error while executing ‘C:\android-ndk-r10c\ndk-build.cmd’ with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=C:\TEST\testFB\frameworks\runtime-src\proj.android-studio\app\jni\Android.mk NDK_APPLICATION_MK=C:\TEST\testFB\frameworks\runtime-src\proj.android-studio\app\jni\Application.mk APP_ABI=armeabi NDK_ALL_ABIS=armeabi NDK_DEBUG=1 APP_PLATFORM=android-15 NDK_OUT=C:/TEST/testFB/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=C:\TEST\testFB\frameworks\runtime-src\proj.android-studio\app\build\intermediates\ndkBuild\debug\lib NDK_TOOLCHAIN_VERSION=4.9 APP_PLATFORM=android-23 NDK_MODULE_PATH=C:/TEST/testFB/frameworks/cocos2d-x;C:/TEST/testFB/frameworks/cocos2d-x/cocos;C:/TEST/testFB/frameworks/cocos2d-x/external -j4 NDK_DEBUG=1 C:/TEST/testFB/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/debug/obj/local/armeabi/libcocos2djs.so}
Android NDK: WARNING: Unsupported source file extensions in C:\TEST\testFB\frameworks\runtime-src\proj.android-studio\app\jni\Android.mk for module cocos2djs_shared
Android NDK: …/…/…/Classes/PluginFacebookJS.hpp …/…/…/Classes/PluginFacebookJSHelper.h …/…/…/Classes/SDKBoxJSHelper.h
[armeabi] SharedLibrary : libcocos2djs.so
arm-linux-androideabi-g++: error: C:TESTtestFBframeworksruntime-srcproj.android-studioappjni/./pluginfacebook/libs_c++_static/armeabi/libPluginFacebook.a: No such file or directory
arm-linux-androideabi-g++: error: C:TESTtestFBframeworksruntime-srcproj.android-studioappjni/./sdkbox/libs_c++_static/armeabi/libsdkbox.a: No such file or directory
make.exe: *** [C:/TEST/testFB/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/debug/obj/local/armeabi/libcocos2djs.so] Error 1

I think some files not got imported into your project or something corupted in android.mk

1 Like

Thanks for your reply. This is my setting in Android :slight_smile: . im doing this after read Manual Integration For Android
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
…/…/…/Classes/PluginFacebookJS.cpp
…/…/…/Classes/PluginFacebookJS.hpp
…/…/…/Classes/PluginFacebookJSHelper.cpp
…/…/…/Classes/PluginFacebookJSHelper.h
…/…/…/Classes/SDKBoxJSHelper.cpp
…/…/…/Classes/SDKBoxJSHelper.h

LOCAL_CPPFLAGS := -DSDKBOX_ENABLED
LOCAL_LDLIBS := -landroid -llog
LOCAL_C_INCLUDES := $(LOCAL_PATH)/…/…/…/Classes
LOCAL_WHOLE_STATIC_LIBRARIES := PluginFacebook sdkbox PluginIAP android_native_app_glue

LOCAL_STATIC_LIBRARIES := cocos2d_js_static

LOCAL_EXPORT_CFLAGS := -DCOCOS2D_DEBUG=2 -DCOCOS2D_JAVASCRIPT

APP_PLATFORM := android-23

include $(BUILD_SHARED_LIBRARY)
$(call import-add-path, $(LOCAL_PATH))

$(call import-module, scripting/js-bindings/proj.android)
$(call import-module, ./sdkbox)
$(call import-module, ./pluginfacebook)

have u checked inside JNI folder that facebook have all libs inside? Also it looks compiler don’t like included …/…/…/Classes/PluginFacebookJS.hpp due it extension

1 Like

yep, have : hellojavascript, pluginfacebook, sdkbox, Android.mk, Application.mk in there.

i think this is problem but i dont know how to fix that :
Android NDK: WARNING: Unsupported source file extensions in C:\TEST\testFB\frameworks\runtime-src\proj.android-studio\app\jni\Android.mk for module cocos2djs_shared
Android NDK: …/…/…/Classes/PluginFacebookJS.hpp …/…/…/Classes/PluginFacebookJSHelper.h …/…/…/Classes/SDKBoxJSHelper.h

but do you have files inside pluginfacebook/armeabi ?

1 Like

yep, i have it,
proj.android-studio\app\jni\pluginfacebook\libs\armeabi\libPluginFacebook.a

It seems that you compile project with APP_STL := c++_static.

please check the file,

proj.android-studio\app\jni\pluginfacebook\libs_c++_static\armeabi\libPluginFacebook.a
1 Like

Thanks for your reply.
I got it too :((
frameworks\runtime-src\proj.android-studio\app\jni\pluginfacebook\libs_c++_static\armeabi\libPluginFacebook.a

sorry but if have some free-time, can you upload your project with successfull integrate fb into cocos project, thank you guys :slight_smile:

plz wait for pushing.

Thanks for your reply.

sorry but i got problem with cocos JS ;((

your real problem, you can ref to Android.mk and Application.mk

https://github.com/yinjimmy/facebook_as_cpp done.
Thanks,

1 Like

Thanks for your reply.
Sorry, but can you tell me what version of NDK you are using ? Im using android-ndk-r10c
I really dont know but i got so much problem with cocos js

Android NDK: WARNING: Ignoring unknown import directory: C:\Users\InMyDream\Desktop\testFB\frameworks\runtime-src\proj.android-studio\app\jni____
Android NDK: C:/Users/InMyDream/Desktop/testFB/frameworks/cocos2d-x/external/flatbuffers/Android.mk: Cannot find module with tag ‘./sdkbox’ in import path
Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?
Android NDK: The following directories were searched:
Android NDK:

$ echo $ANDROID_NDK
/Users/jryin/Documents/SDK/android/android-ndk-r10d
1 Like

Sorry, i got same error with ndk-r10d. im using Windows and i was setup Enviroment path for NDK

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:testFB:generateJsonModelDebug’.

Build command failed.
Error while executing ‘C:\android-ndk-r10d\ndk-build.cmd’ with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=C:\Users\InMyDream\Desktop\testFB\frameworks\runtime-src\proj.android-studio\app\jni\Android.mk NDK_APPLICATION_MK=C:\Users\InMyDream\Desktop\testFB\frameworks\runtime-src\proj.android-studio\app\jni\Application.mk APP_ABI=armeabi NDK_ALL_ABIS=armeabi NDK_DEBUG=1 APP_PLATFORM=android-15 NDK_OUT=C:/Users/InMyDream/Desktop/testFB/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=C:\Users\InMyDream\Desktop\testFB\frameworks\runtime-src\proj.android-studio\app\build\intermediates\ndkBuild\debug\lib NDK_TOOLCHAIN_VERSION=4.9 APP_PLATFORM=android-13 NDK_MODULE_PATH=C:/Users/InMyDream/Desktop/testFB/frameworks/cocos2d-x;C:/Users/InMyDream/Desktop/testFB/frameworks/cocos2d-x/cocos;C:/Users/InMyDream/Desktop/testFB/frameworks/cocos2d-x/external -j4 NDK_DEBUG=1 APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -n}
Android NDK: WARNING: Ignoring unknown import directory: C:\Users\InMyDream\Desktop\testFB\frameworks\runtime-src\proj.android-studio\app\jni____/…/…/…/cocos2d
Android NDK: WARNING: Ignoring unknown import directory: C:\Users\InMyDream\Desktop\testFB\frameworks\runtime-src\proj.android-studio\app\jni____/…/…/…/cocos2d/external
Android NDK: WARNING: Ignoring unknown import directory: C:\Users\InMyDream\Desktop\testFB\frameworks\runtime-src\proj.android-studio\app\jni____/…/…/…/cocos2d/cocos
Android NDK: WARNING: Ignoring unknown import directory: C:\Users\InMyDream\Desktop\testFB\frameworks\runtime-src\proj.android-studio\app\jni____/…/…/…/cocos2d/cocos/audio/include
Android NDK: WARNING: Ignoring unknown import directory: C:\Users\InMyDream\Desktop\testFB\frameworks\runtime-src\proj.android-studio\app\jni____
Android NDK: C:/Users/InMyDream/Desktop/testFB/frameworks/cocos2d-x/external/flatbuffers/Android.mk: Cannot find module with tag ‘./sdkbox’ in import path
Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?
Android NDK: The following directories were searched:
Android NDK:
process_begin: CreateProcess(NULL, “”, …) failed.
C:\Users\InMyDream\Desktop\testFB\frameworks\runtime-src\proj.android-studio\app\jni\Android.mk:39: *** Android NDK: Aborting. . Stop.

pushing.

and plz switch to APP_STL := gnustl_static

which cocos2d-js version you use?

for cocos2d-js 3.15.1 with APP_STL := c++_static , an empty example, I compile failed.

/Users/jryin/test/js3151/frameworks/cocos2d-x/external/spidermonkey/prebuilt/android/armeabi/libjs_static.a(jscntxt.o)(.text+0xb8c): error: undefined reference to 'std::ios_base::ios_base()'
/Users/jryin/test/js3151/frameworks/cocos2d-x/external/spidermonkey/prebuilt/android/armeabi/libjs_static.a(jscntxt.o)(.text+0xbe4): error: undefined reference to 'std::basic_ios<char, std::char_traits<char> >::init(std::basic_streambuf<char, std::char_traits<char> >*)'
/Users/jryin/test/js3151/frameworks/cocos2d-x/external/spidermonkey/prebuilt/android/armeabi/libjs_static.a(jscntxt.o)(.text+0xc04): error: undefined reference to 'std::basic_filebuf<char, std::char_traits<char> >::basic_filebuf()'

Hi @yinjimmy,

I pull your facebook_js_as project and compile with command

cocos compile -p android --android-studio

I’ve got failed message

[quote=""]D:/Works/Cocos/project/sdkbox/facebook_js_as-master/frameworks/cocos2d-x/external/bullet/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuMinkowskiPenetrationDepthSolver.cpp:344:1: fatal error: opening dependency file D:/Works/Cocos/project/sdkbox/facebook_js_as-master/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/debug/obj/local/armeabi/objs-debug/bullet_static/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuMinkowskiPenetrationDepthSolver.o.d: No such file or directory
}
^
compilation terminated.
make: *** [D:/Works/Cocos/project/sdkbox/facebook_js_as-master/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/debug/obj/local/armeabi/objs-debug/bullet_static/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuMinkowskiPenetrationDepthSolver.o] Error 1
make: *** Waiting for unfinished jobs…
[armeabi] Compile++ arm : bullet_static <= btConvexHull.cpp

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.

BUILD FAILED
[/quote]

Can you help me?