根据文档用官方工具导入包,基本就可以编译(第一次导入出问题了,换了导入顺序又可以了,第二次导入顺序是facebook,admob,iap,firebase);
官方文档地址:
http://docs.sdkbox.com/zh/cocos/
但是运行出错,原因是新加的class和库文件没有导入,希望官方能和.mk文件一样自动修改 CMakeLists.txt文件,这样更方便....
修改项目根目录下的CMakeLists.txt:
#加入cpp代码:
if(NOT WINDOWS)
# sdkbox 插件CPP
list(APPEND GAME_HEADER
${RUNTIME_SRC_ROOT}/Classes/lua_module_register.h
${RUNTIME_SRC_ROOT}/Classes/PluginAdMobLua.hpp
${RUNTIME_SRC_ROOT}/Classes/PluginAdMobLuaHelper.h
${RUNTIME_SRC_ROOT}/Classes/PluginFacebookLua.hpp
${RUNTIME_SRC_ROOT}/Classes/PluginFacebookLuaHelper.h
${RUNTIME_SRC_ROOT}/Classes/PluginFirebaseLua.hpp
${RUNTIME_SRC_ROOT}/Classes/PluginFirebaseLuaHelper.h
${RUNTIME_SRC_ROOT}/Classes/PluginIAPLua.hpp
${RUNTIME_SRC_ROOT}/Classes/PluginIAPLuaHelper.h
${RUNTIME_SRC_ROOT}/Classes/PluginSdkboxAdsLua.hpp
${RUNTIME_SRC_ROOT}/Classes/PluginSdkboxAdsLuaHelper.h
${RUNTIME_SRC_ROOT}/Classes/SDKBoxLuaHelper.h
)
list(APPEND GAME_SOURCE
${RUNTIME_SRC_ROOT}/Classes/PluginAdMobLua.cpp
${RUNTIME_SRC_ROOT}/Classes/PluginAdMobLuaHelper.cpp
${RUNTIME_SRC_ROOT}/Classes/PluginFacebookLua.cpp
${RUNTIME_SRC_ROOT}/Classes/PluginFacebookLuaHelper.cpp
${RUNTIME_SRC_ROOT}/Classes/PluginFirebaseLua.cpp
${RUNTIME_SRC_ROOT}/Classes/PluginFirebaseLuaHelper.cpp
${RUNTIME_SRC_ROOT}/Classes/PluginIAPLua.cpp
${RUNTIME_SRC_ROOT}/Classes/PluginIAPLuaHelper.cpp
${RUNTIME_SRC_ROOT}/Classes/PluginSdkboxAdsLua.cpp
${RUNTIME_SRC_ROOT}/Classes/PluginSdkboxAdsLuaHelper.cpp
${RUNTIME_SRC_ROOT}/Classes/SDKBoxLuaHelper.cpp
)
endif()
#引入库文件包含目录
if(ANDROID)
include_directories(
#sdkbox 插件目录
${RUNTIME_SRC_ROOT}/proj.android/app/jni
)
endif()
# sdkbox 插件库文件
if(ANDROID)
add_subdirectory(${RUNTIME_SRC_ROOT}/proj.android/app/jni/PluginAdMob)
add_subdirectory(${RUNTIME_SRC_ROOT}/proj.android/app/jni/PluginFacebook)
add_subdirectory(${RUNTIME_SRC_ROOT}/proj.android/app/jni/PluginFirebase)
add_subdirectory(${RUNTIME_SRC_ROOT}/proj.android/app/jni/PluginIAP)
add_subdirectory(${RUNTIME_SRC_ROOT}/proj.android/app/jni/PluginSdkboxAds)
add_subdirectory(${RUNTIME_SRC_ROOT}/proj.android/app/jni/sdkbox)
target_link_libraries(${APP_NAME}
ext_PluginAdMob
ext_PluginFacebook
ext_PluginFirebase
ext_PluginIAP
ext_PluginSdkboxAds
ext_sdkbox
)
endif()