当前位置: 动力学知识库 > 问答 > 编程问答 >

java - Fatal Exception in Game Development with Cocos2D

问题描述:

I'm new in Java and I getting a Fatal Exception with Cocos2D.

My Main Activity:

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

// landscape orientation

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

requestWindowFeature(Window.FEATURE_NO_TITLE);

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

// view

CCGLSurfaceView glSurfaceView = new CCGLSurfaceView(this);

setContentView(glSurfaceView);

CCDirector.sharedDirector().attachInView(glSurfaceView);

// sensor manager

configSensormanager();

// configure CCDirector

CCDirector.sharedDirector().setScreenSize(320, 480);

// Starts title screen

CCScene scene = new TitleScreen().scene();

CCDirector.sharedDirector().runWithScene(scene);

}

private void configSensormanager() {

SensorManager sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);

DeviceSettings.setSensorManager(sensorManager);

}

ERROR

05-15 17:42:12.260: E/AndroidRuntime(3001): FATAL EXCEPTION: main

05-15 17:42:12.260: E/AndroidRuntime(3001): Process: br.com.spaceandtime, PID: 3001

05-15 17:42:12.260: E/AndroidRuntime(3001): java.lang.NoClassDefFoundError: Failed resolution of: Lorg/cocos2d/nodes/CCDirector;

05-15 17:42:12.260: E/AndroidRuntime(3001): at br.com.spaceandtime.MainActivity.onCreate(MainActivity.java:34)

I already tried change the cocos2d lib but it's not works

and I'm from Brazil so... sorry for my bad english

分享给朋友:
您可能感兴趣的文章:
随机阅读: