由于Admob插件,无法为Android编译Cocos2d-x游戏

时间:2019-07-18 13:20:21

标签: android c++ cocos2d-x cocos2d-x-3.0

我用cocos2d-x制作了一个游戏,它在iOS上运行没有任何问题,我已经在App Store上发布了它。但是以某种方式它在Android上不起作用,我尝试使用“ cocos compile -s〜/ path / to / game / -p android”命令编译它,但出现以下错误:

/Users/lukas/Documents/CocosGame/Classes/AppDelegate.cpp:27:10: fatal error: 'PluginAdMob/PluginAdMob.h' file not found
  #include "PluginAdMob/PluginAdMob.h"
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  1 error generated.
  ninja: build stopped: subcommand failed.

我在gradle属性中将构建类型定义为:“ PROP_BUILD_TYPE = ndk-build”。在Android.mk中,我正确地包含了我所有的插件,看起来像这样:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := MyGame_shared

LOCAL_MODULE_FILENAME := libMyGame

LOCAL_SRC_FILES := \
$(LOCAL_PATH)/../../../Classes/AppDelegate.cpp \
# $(LOCAL_PATH)/hellocpp/main.cpp \
$(LOCAL_PATH)/../../../Classes/MenuScene.cpp \
all classes...

LOCAL_CPPFLAGS := -DSDKBOX_ENABLED \
-DSDKBOX_COCOS_CREATOR
LOCAL_LDLIBS := -landroid \
-llog
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../Classes

# _COCOS_HEADER_ANDROID_BEGIN
# _COCOS_HEADER_ANDROID_END

LOCAL_WHOLE_STATIC_LIBRARIES += sdkbox
LOCAL_WHOLE_STATIC_LIBRARIES += PluginSdkboxAds
LOCAL_WHOLE_STATIC_LIBRARIES += PluginAdMob
LOCAL_WHOLE_STATIC_LIBRARIES += PluginShare
LOCAL_WHOLE_STATIC_LIBRARIES += PluginSdkboxPlay

LOCAL_STATIC_LIBRARIES := cc_static

# _COCOS_LIB_ANDROID_BEGIN
# _COCOS_LIB_ANDROID_END

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

$(call import-module, cocos)
$(call import-module, ./sdkbox)
$(call import-module, ./PluginSdkboxAds)
$(call import-module, ./PluginAdmob)
$(call import-module, ./PluginShare)
$(call import-module, ./PluginSdkboxPlay)

# _COCOS_LIB_IMPORT_ANDROID_BEGIN
# _COCOS_LIB_IMPORT_ANDROID_END

如何解决此错误?我试图找到一个解决方案已有几个小时了,但对我来说却无济于事...

0 个答案:

没有答案