黑色屏幕的Android应用程序

时间:2012-11-16 08:54:31

标签: android cocos2d-x

我正在使用cpp工作非常基本的Android应用程序,它显示背景图像(使用cocos2d-x框架)。

应用程序编译正常,.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文件中的重复项有任何清理建议,我真的很感激。

1 个答案:

答案 0 :(得分:0)

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

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