刚从 Andengine 开始。我使用这个博客来安装基本的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;
}
}