我正在关注Raywenderlich tutorial of cocos2dx for android build,我正在使用ndk-r8d和cocos2d-2.1beta3-x-2.1.0。我刚创建了一个示例项目,我的应用程序在Android设备上崩溃,并带有以下日志。帮帮我!!!!
04-07 23:33:44.777: E/AndroidRuntime(24626): FATAL EXCEPTION: main
04-07 23:33:44.777: E/AndroidRuntime(24626): java.lang.RuntimeException: Unable to resume activity {com.softmasters.me/com.softmasters.me.me}: java.lang.NullPointerException
04-07 23:33:44.777: E/AndroidRuntime(24626): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2826)
04-07 23:33:44.777: E/AndroidRuntime(24626): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2855)
04-07 23:33:44.777: E/AndroidRuntime(24626): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2300)
04-07 23:33:44.777: E/AndroidRuntime(24626): at android.app.ActivityThread.access$700(ActivityThread.java:150)
04-07 23:33:44.777: E/AndroidRuntime(24626): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
04-07 23:33:44.777: E/AndroidRuntime(24626): at android.os.Handler.dispatchMessage(Handler.java:99)
04-07 23:33:44.777: E/AndroidRuntime(24626): at android.os.Looper.loop(Looper.java:176)
04-07 23:33:44.777: E/AndroidRuntime(24626): at android.app.ActivityThread.main(ActivityThread.java:5279)
04-07 23:33:44.777: E/AndroidRuntime(24626): at java.lang.reflect.Method.invokeNative(Native Method)
04-07 23:33:44.777: E/AndroidRuntime(24626): at java.lang.reflect.Method.invoke(Method.java:511)
04-07 23:33:44.777: E/AndroidRuntime(24626): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
04-07 23:33:44.777: E/AndroidRuntime(24626): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
04-07 23:33:44.777: E/AndroidRuntime(24626): at dalvik.system.NativeStart.main(Native Method)
04-07 23:33:44.777: E/AndroidRuntime(24626): Caused by: java.lang.NullPointerException
04-07 23:33:44.777: E/AndroidRuntime(24626): at android.opengl.GLSurfaceView.onResume(GLSurfaceView.java:569)
04-07 23:33:44.777: E/AndroidRuntime(24626): at org.cocos2dx.lib.Cocos2dxGLSurfaceView.onResume(Cocos2dxGLSurfaceView.java:158)
04-07 23:33:44.777: E/AndroidRuntime(24626): at org.cocos2dx.lib.Cocos2dxActivity.onResume(Cocos2dxActivity.java:76)
04-07 23:33:44.777: E/AndroidRuntime(24626): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1202)
04-07 23:33:44.777: E/AndroidRuntime(24626): at android.app.Activity.performResume(Activity.java:5345)
04-07 23:33:44.777: E/AndroidRuntime(24626): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2816)
04-07 23:33:44.777: E/AndroidRuntime(24626): ... 12 more
答案 0 :(得分:0)
尝试运行" ./ build_native.sh clean"之后" ./ build_native.sh"该应用程序无法运行,因为没有找到cocos2d-x编译的文件。
确保构建本机正确运行而没有任何错误。