3

我正在使用显示背景图像(使用 cocos2d-x 框架)的 cpp 开发非常基本的 android 应用程序。

该应用程序编译良好,.apk 文件有我正在使用的 png 文件。但是在 Galaxy Note (Android 4.1) 上启动它时,它只显示黑屏。我还尝试添加背景声音,看看它是否播放,但没有运气。

我也尝试使用动态库而不是静态库,但没有运气。Android调试部分工作,所以我无法成功调试它。

谁能帮忙,我的设置有什么问题?对不起,长篇大论。

我的 Android 和应用程序 mk 文件看起来像这样 -

====================================

../类/Android.mk

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := game_logic_static

LOCAL_MODULE_FILENAME := libgame_logic

LOCAL_SRC_FILES := AppDelegate.cpp \
                 
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) \
                        $(LOCAL_PATH)/../.. \

LOCAL_STATIC_LIBRARIES := png_static_prebuilt
LOCAL_STATIC_LIBRARIES += xml2_static_prebuilt
LOCAL_STATIC_LIBRARIES += jpeg_static_prebuilt
LOCAL_WHOLE_STATIC_LIBRARIES += cocos2dx_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static

include $(BUILD_STATIC_LIBRARY)

$(call import-module,cocos2dx/platform/third_party/android/prebuilt/libpng)
$(call import-module,cocos2dx/platform/third_party/android/prebuilt/libxml2)
$(call import-module,cocos2dx/platform/third_party/android/prebuilt/libjpeg)

====================================

../jni/Android.mk

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

subdirs := $(addprefix $(LOCAL_PATH)/../../../,$(addsuffix /Android.mk, \
           cocos2dx \
           CocosDenshion/android \
              \
           ))
    
subdirs += $(LOCAL_PATH)/../../Classes/Android.mk $(LOCAL_PATH)/hellocpp/Android.mk

include $(subdirs)

../jni/hellocpp/Android.mk

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := game_shared

LOCAL_MODULE_FILENAME := libgame

LOCAL_SRC_FILES := main.cpp \
                   ../../../Classes/HelloWorldScene.cpp \

LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) \
                        $(LOCAL_PATH)/../../../../ \
                        $(LOCAL_PATH)/../../../../CocosDenshion/android \
                        $(LOCAL_PATH)/../../../../CocosDenshion/android/jni \
                        $(LOCAL_PATH)/../../../../CocosDenshion/include \
                        
LOCAL_STATIC_LIBRARIES := png_static_prebuilt
LOCAL_STATIC_LIBRARIES += xml2_static_prebuilt
LOCAL_STATIC_LIBRARIES += jpeg_static_prebuilt
LOCAL_STATIC_LIBRARIES += curl_static_prebuilt
LOCAL_WHOLE_STATIC_LIBRARIES := game_logic_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos2dx_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static
            
include $(BUILD_SHARED_LIBRARY)

$(call import-module,cocos2dx/platform/third_party/android/prebuilt/libcurl)
$(call import-module,cocos2dx/platform/third_party/android/prebuilt/libpng)
$(call import-module,cocos2dx/platform/third_party/android/prebuilt/libxml2)
$(call import-module,cocos2dx/platform/third_party/android/prebuilt/libjpeg)

../jni/Application.mk:

APP_STL := gnustl_static
APP_CPPFLAGS += -frtti
APP_MODULES := cocos2dx_static cocosdenshion_static game_logic_static game_shared

====================================

如果您对这些 mk 文件中的重复项有任何清理建议,我将不胜感激。

4

1 回答 1

0

您是否提供了背景精灵中使用的正确资源名称?

您还可以检查您正在访问的资源是否存在于您的资产中?

于 2012-12-11T05:53:47.793 回答