AndEngine致命错误

时间:2012-11-18 23:29:11

标签: java android andengine

刚开始使用Andengine。我使用this blog来安装基本AndEngine,一切似乎都有效,直到我尝试从博客运行我的基本Hello world应用程序。这是代码和错误日志。任何帮助表示赞赏。

日志

11-18 14:18:26.484: E/AndroidRuntime(19380): FATAL EXCEPTION: main
11-18 14:18:26.484: E/AndroidRuntime(19380): java.lang.RuntimeException: Unable to   instantiate activity ComponentInfo{com.example.and/com.example.and.MainActivity}: java.lang.ClassNotFoundException: com.example.and.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.and-2.apk]
11-18 14:18:26.484: E/AndroidRuntime(19380):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569)

代码

package com.example.and;

 import org.andengine.engine.camera.Camera;
 import org.andengine.engine.options.EngineOptions;
 import org.andengine.engine.options.ScreenOrientation;
 import org.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;
 import org.andengine.entity.scene.Scene;
 import org.andengine.entity.scene.background.Background;
 import org.andengine.ui.activity.SimpleBaseGameActivity;

public class TestActivity extends SimpleBaseGameActivity {

static final int CAMERA_WIDTH = 800;
static final int CAMERA_HEIGHT = 480;

@Override
public EngineOptions onCreateEngineOptions() {
    Camera mCamera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
    return new EngineOptions(true, ScreenOrientation.LANDSCAPE_SENSOR,
        new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), mCamera);
}

@Override
protected void onCreateResources() {
    // TODO Auto-generated method stub
}

@Override
protected Scene onCreateScene() {
    Scene scene = new Scene();
    scene.setBackground(new Background(0.09804f, 0.6274f, 0));
    return scene;
}
}

1 个答案:

答案 0 :(得分:1)

确保您的活动在清单文件中声明