其他分享
首页 > 其他分享> > Android-Cocos 2D NullPointer异常

Android-Cocos 2D NullPointer异常

作者:互联网

我遵循了以下教程中的指南.
http://dan.clarke.name/2011/04/how-to-make-a-simple-android-game-with-cocos2d/

在第一次运行时,我遇到了以下错误.

04-29 10:21:08.022: E/AndroidRuntime(12702): FATAL EXCEPTION: GLThread 10
04-29 10:21:08.022: E/AndroidRuntime(12702): java.lang.NullPointerException
04-29 10:21:08.022: E/AndroidRuntime(12702):    at org.cocos2d.nodes.CCAtlasNode.updateBlendFunc(CCAtlasNode.java:168)
04-29 10:21:08.022: E/AndroidRuntime(12702):    at org.cocos2d.nodes.CCAtlasNode.<init>(CCAtlasNode.java:77)
04-29 10:21:08.022: E/AndroidRuntime(12702):    at org.cocos2d.nodes.CCLabelAtlas.<init>(CCLabelAtlas.java:40)
04-29 10:21:08.022: E/AndroidRuntime(12702):    at org.cocos2d.nodes.CCLabelAtlas.label(CCLabelAtlas.java:35)
04-29 10:21:08.022: E/AndroidRuntime(12702):    at org.cocos2d.nodes.CCDirector.setGLDefaultValues(CCDirector.java:593)
04-29 10:21:08.022: E/AndroidRuntime(12702):    at org.cocos2d.nodes.CCDirector.onSurfaceCreated(CCDirector.java:636)
04-29 10:21:08.022: E/AndroidRuntime(12702):    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1349)
04-29 10:21:08.022: E/AndroidRuntime(12702):    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1119)

解决方法:

该库不再更新.最好开始使用:http://www.cocos2d-x.org/.它使用C,要在android上工作,请使用JNI(本机代码).可以将代码移植到其他任何平台,例如IOS.

希望对您有所帮助!

标签:cocos2d-android,2d,nullpointerexception,android
来源: https://codeday.me/bug/20191201/2080500.html