[SOLVED] Jsapi.h not found. Youtube Plugin


#1

I tried to compile a project with integrated Youtube player from SDKBox for Android (Android Studio, android-26). The project is builded with Cocos Creator 1.8.1. The error 'Jsapi.h not found' occurred. I solved this problem by next actions:

  • added a line to **/cocos/Android.mk in LOCAL_EXPORT_C_INCLUDES $(LOCAL_PATH)/../external/android/$(TARGET_ARCH_ABI)/include/spidermonkey.
  • Then error occures about ambiguous of RefPtr class. There’s such class from Mozilla (spidermonkey) which conflcts with RefPtr from Cocos2d-x. I had to refactor class RefPtr(Cocos) to CCRefPtr since files no exist refering to that class.
  • -fpermissive compile key is appended in **/proj.android-studio/app/jni/Application.mk file.
  • file PluginYoutubeJSHelper.h is modified by changing function prototype
    void register_all_PluginYoutubeJS_helper(JSContext* cx, JS::HandleObject global);
    to
    bool register_all_PluginYoutubeJS_helper(se::Object* obj);
    and added #include "cocos/scripting/js-bindings/jswrapper/SeApi.h" at the top of the file.

Certainly these are not the best actions to fix the error. Please, write what I could to do to workaround this problem more correct.


#2

Which version of SDKBOX are you using?


#3

http://docs.sdkbox.com/en/plugins/youtube/v3-js/#add-assets-folder_1

Copy all source and header files from plugin/jsbindings/ to your projects Classes folder.

NOTE: plugin/jsbindings/jsb2 for creator 1.7.


#4

I used SDKBOX v1.0.1.31.
@yinjimmy, oops, I didn’t see that although I accomplished rest items. Thank you!