[SOLVED] Jsapi.h not found. Youtube Plugin

[SOLVED] Jsapi.h not found. Youtube Plugin
0.0 0

#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!


#5

i tried this, i still get the problem ‘Jsapi.h not found’


#6

what did you do?


#7

i updated my cocos from 1.6.1 to 1.8.1, i got an error to delete build file and rebuild, after i did that i injects all the sdkbox plugins i had from before. when i compiled i got this error in log. i tried using both binary and default, same error

[armeabi] Compile++ arm : cocos2djs_shared <= jsb_module_register.cpp
[armeabi] Compile++ arm : cocos2djs_shared <= PluginSdkboxPlayJS.cpp
In file included from C:/Users/Freshprince/Desktop/Coco2dxProject/testCocos/build/jsb-binary/frameworks/runtime-src/proj.android-studio/app/jni/…/…/…/Classes/AppDelegate.cpp:32:0:
C:/Users/Freshprince/Desktop/Coco2dxProject/testCocos/build/jsb-binary/frameworks/runtime-src/proj.android-studio/app/jni/…/…/…/Classes/PluginYoutubeJSHelper.h:4:19: fatal error: jsapi.h: No such file or directory
#include “jsapi.h”
^
compilation terminated.
make: *** [C:/Users/Freshprince/Desktop/Coco2dxProject/testCocos/build/jsb-binary/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/release/obj/local/armeabi/objs/cocos2djs_shared///__/Classes/AppDelegate.o] Error 1
make: *** Waiting for unfinished jobs…
:WhatYuhKnow:externalNativeBuildRelease FAILED
:WhatYuhKnow:externalNativeBuildRelease (Thread[Task worker for ‘:’,5,main]) completed. Took 14.337 secs.

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:WhatYuhKnow:externalNativeBuildRelease’.

Build command failed.
Error while executing process C:\Users\Freshprince\Desktop\adt-bundle-windows-x86_64-20140321\sdk\ndk-bundle\ndk-build.cmd with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=C:\Users\Freshprince\Desktop\Coco2dxProject\testCocos\build\jsb-binary\frameworks\runtime-src\proj.android-studio\app\jni\Android.mk NDK_APPLICATION_MK=C:\Users\Freshprince\Desktop\Coco2dxProject\testCocos\build\jsb-binary\frameworks\runtime-src\proj.android-studio\app\jni\Application.mk APP_ABI=armeabi NDK_ALL_ABIS=armeabi NDK_DEBUG=0 APP_PLATFORM=android-16 NDK_OUT=C:/Users/Freshprince/Desktop/Coco2dxProject/testCocos/build/jsb-binary/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/release/obj NDK_LIBS_OUT=C:\Users\Freshprince\Desktop\Coco2dxProject\testCocos\build\jsb-binary\frameworks\runtime-src\proj.android-studio\app\build\intermediates\ndkBuild\release\lib NDK_TOOLCHAIN_VERSION=4.9 APP_PLATFORM=android-27 NDK_MODULE_PATH=C:\CocosCreator\resources\cocos2d-x;C:\CocosCreator\resources\cocos2d-x\cocos;C:\CocosCreator\resources\cocos2d-x\external -j4 NDK_DEBUG=0 C:/Users/Freshprince/Desktop/Coco2dxProject/testCocos/build/jsb-binary/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/release/obj/local/armeabi/libcocos2djs.so}
C:/Users/Freshprince/Desktop/adt-bundle-windows-x86_64-20140321/sdk/ndk-bundle/build//…/build/core/setup-app.mk:81: Android NDK: Application targets deprecated ABI(s): armeabi
C:/Users/Freshprince/Desktop/adt-bundle-windows-x86_64-20140321/sdk/ndk-bundle/build//…/build/core/setup-app.mk:82: Android NDK: Support for these ABIs will be removed in a future NDK release.
[armeabi] Compile++ arm : cocos2djs_shared <= main.cpp
[armeabi] Compile++ arm : cocos2djs_shared <= AppDelegate.cpp
[armeabi] Compile++ arm : cocos2djs_shared <= jsb_module_register.cpp
[armeabi] Compile++ arm : cocos2djs_shared <= PluginSdkboxPlayJS.cpp
In file included from C:/Users/Freshprince/Desktop/Coco2dxProject/testCocos/build/jsb-binary/frameworks/runtime-src/proj.android-studio/app/jni/…/…/…/Classes/AppDelegate.cpp:32:0:
C:/Users/Freshprince/Desktop/Coco2dxProject/testCocos/build/jsb-binary/frameworks/runtime-src/proj.android-studio/app/jni/…/…/…/Classes/PluginYoutubeJSHelper.h:4:19: fatal error: jsapi.h: No such file or directory
#include “jsapi.h”
^
compilation terminated.
make: *** [C:/Users/Freshprince/Desktop/Coco2dxProject/testCocos/build/jsb-binary/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/release/obj/local/armeabi/objs/cocos2djs_shared///__/Classes/AppDelegate.o] Error 1
make: *** Waiting for unfinished jobs…

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

101 actionable tasks: 2 executed, 99 up-to-date

BUILD FAILED in 24s
Error running command, return code: 1.


#8

OK. I checked the PluginYoutubeJSHelper.h, it’s not correct.

plz update the PluginYoutubeJSHelper.h with bellow code:


#pragma once

#include "cocos/scripting/js-bindings/jswrapper/SeApi.h"
#include "scripting/js-bindings/manual/jsb_conversions.hpp"

namespace se {
    class Object;
}

bool register_all_PluginYoutubeJS_helper(se::Object* obj);

Thanks,


#9

thanks, this solved the problem