Cocos2d-x |在模拟器上运行时出错

时间:2013-05-21 19:54:22

标签: c++ eclipse android-emulator cocos2d-iphone cocos2d-x

我是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

任何人对我错过或做错了什么有任何想法?

感谢任何帮助,谢谢。

1 个答案:

答案 0 :(得分:0)

首先,使用最新的NDK(此时为android-ndk-r8e),较旧的NDK在运行cocos2d-x时出现问题。第二步,检查您的模拟器是否已打开“使用主机GPU”选项。