mhamon1992 / cocos2d-android-1

Automatically exported from code.google.com/p/cocos2d-android-1
0 stars 0 forks source link

初始化调用setProjection(CCDirector.kCCDirectorProjection2D); CRASH #49

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
// attach the OpenGL view to a window
            CCDirector.sharedDirector().attachInView(mGLSurfaceView);

            // no effect here because device orientation is controlled by manifest
            CCDirector.sharedDirector().setDeviceOrientation(CCDirector.kCCDeviceOrientationPortrait);        

            // show FPS
            // set false to disable FPS display, but don't delete fps_images.png!!
            CCDirector.sharedDirector().setDisplayFPS(true);

            // frames per second
            CCDirector.sharedDirector().setAnimationInterval(1.0f / 60);

            CCDirector.sharedDirector().setProjection(CCDirector.kCCDirectorProjection2D);

            CCScene scene = GameTableLayer.scene(9);

            // Make the Scene active
            CCDirector.sharedDirector().runWithScene(scene);

////////////////////////////////////////////////////////////////////
直接CRASH
01-28 00:32:34.737: ERROR/AndroidRuntime(2766): java.lang.RuntimeException: 
Unable to start activity 
ComponentInfo{com.geaxgame.pokerking/com.geaxgame.pokerking.PokerKinGActivity}: 
java.lang.NullPointerException
01-28 00:32:34.737: ERROR/AndroidRuntime(2766):     at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
01-28 00:32:34.737: ERROR/AndroidRuntime(2766):     at 
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
01-28 00:32:34.737: ERROR/AndroidRuntime(2766):     at 
android.app.ActivityThread.access$2300(ActivityThread.java:125)
01-28 00:32:34.737: ERROR/AndroidRuntime(2766):     at 
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
01-28 00:32:34.737: ERROR/AndroidRuntime(2766):     at 
android.os.Handler.dispatchMessage(Handler.java:99)
01-28 00:32:34.737: ERROR/AndroidRuntime(2766):     at 
android.os.Looper.loop(Looper.java:123)
01-28 00:32:34.737: ERROR/AndroidRuntime(2766):     at 
android.app.ActivityThread.main(ActivityThread.java:4627)
01-28 00:32:34.737: ERROR/AndroidRuntime(2766):     at 
java.lang.reflect.Method.invokeNative(Native Method)
01-28 00:32:34.737: ERROR/AndroidRuntime(2766):     at 
java.lang.reflect.Method.invoke(Method.java:521)
01-28 00:32:34.737: ERROR/AndroidRuntime(2766):     at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
01-28 00:32:34.737: ERROR/AndroidRuntime(2766):     at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
01-28 00:32:34.737: ERROR/AndroidRuntime(2766):     at 
dalvik.system.NativeStart.main(Native Method)
01-28 00:32:34.737: ERROR/AndroidRuntime(2766): Caused by: 
java.lang.NullPointerException
01-28 00:32:34.737: ERROR/AndroidRuntime(2766):     at 
org.cocos2d.nodes.CCDirector.setProjection(CCDirector.java:122)
01-28 00:32:34.737: ERROR/AndroidRuntime(2766):     at 
com.geaxgame.pokerking.PokerKinGActivity.onCreate(PokerKinGActivity.java:62)
01-28 00:32:34.737: ERROR/AndroidRuntime(2766):     at 
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
01-28 00:32:34.737: ERROR/AndroidRuntime(2766):     at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
01-28 00:32:34.737: ERROR/AndroidRuntime(2766):     ... 11 more
01-28 00:34:03.657: ERROR/Tethering(124): active iface (usb0) reported as 
added, ignoring

Original issue reported on code.google.com by *yun.ji...@dianping.com on 27 Jan 2011 at 4:38