gpt4 book ai didi

java - AndEngine fatal error

转载 作者:行者123 更新时间:2023-12-01 15:02:26 25 4
gpt4 key购买 nike

刚刚开始使用 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;
}
}

最佳答案

确保您的 Activity 已在 list 文件中声明

关于java - AndEngine fatal error ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13445730/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com