0

我是 cocos2d-x 的新手。我在 Windows 8 / Eclipse 中配置 cocos2d-x 并使用 android-ndk-r8b。我创建了一个正在运行的项目(HelloWorld)。该程序在模拟器中运行时出现以下错误:

05-21 20:17:14.357: E/AndroidRuntime(336): FATAL EXCEPTION: main
05-21 20:17:14.357: E/AndroidRuntime(336): java.lang.RuntimeException: Unable to start  activity ComponentInfo{com.nabeelahmad.molitx/com.nabeelahmad.molitx.moleitx}: java.lang.IllegalStateException: setRenderer has already been called for this instance.
05-21 20:17:14.357: E/AndroidRuntime(336):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
05-21 20:17:14.357: E/AndroidRuntime(336):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
05-21 20:17:14.357: E/AndroidRuntime(336):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
05-21 20:17:14.357: E/AndroidRuntime(336):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
05-21 20:17:14.357: E/AndroidRuntime(336):  at android.os.Handler.dispatchMessage(Handler.java:99)
05-21 20:17:14.357: E/AndroidRuntime(336):  at android.os.Looper.loop(Looper.java:123)
05-21 20:17:14.357: E/AndroidRuntime(336):  at android.app.ActivityThread.main(ActivityThread.java:3683)
05-21 20:17:14.357: E/AndroidRuntime(336):  at java.lang.reflect.Method.invokeNative(Native Method)
05-21 20:17:14.357: E/AndroidRuntime(336):  at java.lang.reflect.Method.invoke(Method.java:507)
05-21 20:17:14.357: E/AndroidRuntime(336):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
05-21 20:17:14.357: E/AndroidRuntime(336):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
05-21 20:17:14.357: E/AndroidRuntime(336):  at dalvik.system.NativeStart.main(Native Method)
05-21 20:17:14.357: E/AndroidRuntime(336): Caused by: java.lang.IllegalStateException: setRenderer has already been called for this instance.
05-21 20:17:14.357: E/AndroidRuntime(336):  at android.opengl.GLSurfaceView.checkRenderThreadState(GLSurfaceView.java:1614)
05-21 20:17:14.357: E/AndroidRuntime(336):  at android.opengl.GLSurfaceView.setEGLConfigChooser(GLSurfaceView.java:355)
05-21 20:17:14.357: E/AndroidRuntime(336):  at android.opengl.GLSurfaceView.setEGLConfigChooser(GLSurfaceView.java:392)
05-21 20:17:14.357: E/AndroidRuntime(336):  at com.nabeelahmad.molitx.moleitx.onCreate(moleitx.java:78)
05-21 20:17:14.357: E/AndroidRuntime(336):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-21 20:17:14.357: E/AndroidRuntime(336):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
05-21 20:17:14.357: E/AndroidRuntime(336):  ... 11 more

有人对我遗漏或做错了什么有任何想法吗?

感谢任何帮助,谢谢。

4

1 回答 1

0

一开始使用最新的NDK(目前是android-ndk-r8e),旧的NDK在运行cocos2d-x时会出现问题。其次,检查您的模拟器是否打开了“使用主机 GPU”选项。

于 2013-05-23T12:31:53.013 回答