AndEngine のメイン ページから例をコピーしたところですが、アプリは常にエミュレータで強制的に停止されます:((。助けてください。主なアクティビティは次のとおりです。
public class HelloMe extends BaseGameActivity {
private static final int CAMERA_WIDTH = 720;
private static final int CAMERA_HEIGHT = 480;
// ===========================================================
// Fields
// ===========================================================
private Camera mCamera;
private BitmapTextureAtlas mFontTexture;
private Font mFont;
@Override
public Engine onLoadEngine() {
// TODO Auto-generated method stub
this.mCamera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
return new Engine(new EngineOptions(true, ScreenOrientation.LANDSCAPE, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), this.mCamera));
}
@Override
public void onLoadResources() {
// TODO Auto-generated method stub
this.mFontTexture = new BitmapTextureAtlas(256, 256, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
this.mFont = new Font(this.mFontTexture, Typeface.create(Typeface.DEFAULT, Typeface.BOLD), 32, true, Color.BLACK);
this.mEngine.getTextureManager().loadTexture(this.mFontTexture);
this.getFontManager().loadFont(this.mFont);
}
@Override
public Scene onLoadScene() {
this.mEngine.registerUpdateHandler(new FPSLogger());
final Scene scene = new Scene();
scene.setBackground(new ColorBackground(0.09804f, 0.6274f, 0.8784f));
final Text textCenter = new Text(100, 60, this.mFont, "Hello AndEngine!\nYou can even have multilined text!", HorizontalAlign.CENTER);
final Text textLeft = new Text(100, 200, this.mFont, "Also left aligned!\nLorem ipsum dolor sit amat...", HorizontalAlign.LEFT);
final Text textRight = new Text(100, 340, this.mFont, "And right aligned!\nLorem ipsum dolor sit amat...", HorizontalAlign.RIGHT);
scene.attachChild(textCenter);
scene.attachChild(textLeft);
scene.attachChild(textRight);
return scene;
}
@Override
public void onLoadComplete() {
// TODO Auto-generated method stub
}
}
マニフェスト ファイル:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hello"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="15" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".HelloMe"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Android 4.0.3 を使用し、Build Path に andengine.jar を追加しました。AndEngine は Android 2.2 でしか動作しませんか? 前もって感謝します:D.
PS: これはスタック トレースです:
05-09 22:04:08.311: E/AndroidRuntime(628): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.hello/com.hello.HelloMe}: java.lang.ClassNotFoundException: com.hello.HelloMe
05-09 22:04:08.311: E/AndroidRuntime(628): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1880)
05-09 22:04:08.311: E/AndroidRuntime(628): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
05-09 22:04:08.311: E/AndroidRuntime(628): at android.app.ActivityThread.access$600(ActivityThread.java:123)
05-09 22:04:08.311: E/AndroidRuntime(628): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
05-09 22:04:08.311: E/AndroidRuntime(628): at android.os.Handler.dispatchMessage(Handler.java:99)
05-09 22:04:08.311: E/AndroidRuntime(628): at android.os.Looper.loop(Looper.java:137)
05-09 22:04:08.311: E/AndroidRuntime(628): at android.app.ActivityThread.main(ActivityThread.java:4424)
05-09 22:04:08.311: E/AndroidRuntime(628): at java.lang.reflect.Method.invokeNative(Native Method)
05-09 22:04:08.311: E/AndroidRuntime(628): at java.lang.reflect.Method.invoke(Method.java:511)
05-09 22:04:08.311: E/AndroidRuntime(628): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-09 22:04:08.311: E/AndroidRuntime(628): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-09 22:04:08.311: E/AndroidRuntime(628): at dalvik.system.NativeStart.main(Native Method)
05-09 22:04:08.311: E/AndroidRuntime(628): Caused by: java.lang.ClassNotFoundException: com.hello.HelloMe
05-09 22:04:08.311: E/AndroidRuntime(628): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
05-09 22:04:08.311: E/AndroidRuntime(628): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
05-09 22:04:08.311: E/AndroidRuntime(628): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
05-09 22:04:08.311: E/AndroidRuntime(628): at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
05-09 22:04:08.311: E/AndroidRuntime(628): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1871)