0
我下面Raywenderlich tutorial of cocos2dx for android build,我使用NDK-R 8d中和Cocos2d-2.1beta3-X-2.1。 0爲此。我剛剛創建了一個樣本項目和Android設備上我的應用程序崩潰,並顯示以下日誌。幫我 !!!!Cocos2dx Android應用程式會在設備上「了java.lang.RuntimeException:無法恢復活動」,「顯示java.lang.NullPointerException」
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
我沒有使用cocos2d的建議,但您的堆棧跟蹤表明該問題在的onResume方法造成的。 – donfuxx
@donfuxx我不是機器人專家。你能爲onRusume方法建議一些代碼的和平嗎? –
的Android活動的生命週期方法。其中之一是onResume。通過堆棧跟蹤cocos2d的閱讀似乎實現,在Cocos2dxActivity.onResume – donfuxx