こんにちは皆さん、私はプログラミングを始めたばかりで、最近、Mario Zechner の本「Beginning Android Games」を借りました。彼は、mr nom という名前のゲームの作成方法を教えてくれました。私はすべての指示に従い、名前を mr nom から mrsnakey に変更しました。
私のlogcatエラーは次のとおりです。
04-25 08:37:16.422: I/Process(856): Sending signal. PID: 856 SIG: 9
04-25 08:39:58.712: W/dalvikvm(863): Unable to resolve superclass of Lcom/zardtechnologies/mrsnakey/MrSnakey; (15)
04-25 08:39:58.752: W/dalvikvm(863): Link of class 'Lcom/zardtechnologies/mrsnakey/MrSnakey;' failed
04-25 08:39:58.752: D/AndroidRuntime(863): Shutting down VM
04-25 08:39:58.752: W/dalvikvm(863): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
04-25 08:39:58.792: E/AndroidRuntime(863): FATAL EXCEPTION: main
04-25 08:39:58.792: E/AndroidRuntime(863): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.zardtechnologies.mrsnakey/com.zardtechnologies.mrsnakey.MrSnakey}: java.lang.ClassNotFoundException: com.zardtechnologies.mrsnakey.MrSnakey in loader dalvik.system.PathClassLoader[/data/app/com.zardtechnologies.mrsnakey-2.apk]
04-25 08:39:58.792: E/AndroidRuntime(863): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
04-25 08:39:58.792: E/AndroidRuntime(863): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-25 08:39:58.792: E/AndroidRuntime(863): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-25 08:39:58.792: E/AndroidRuntime(863): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-25 08:39:58.792: E/AndroidRuntime(863): at android.os.Handler.dispatchMessage(Handler.java:99)
04-25 08:39:58.792: E/AndroidRuntime(863): at android.os.Looper.loop(Looper.java:123)
04-25 08:39:58.792: E/AndroidRuntime(863): at android.app.ActivityThread.main(ActivityThread.java:4627)
04-25 08:39:58.792: E/AndroidRuntime(863): at java.lang.reflect.Method.invokeNative(Native Method)
04-25 08:39:58.792: E/AndroidRuntime(863): at java.lang.reflect.Method.invoke(Method.java:521)
04-25 08:39:58.792: E/AndroidRuntime(863): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-25 08:39:58.792: E/AndroidRuntime(863): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-25 08:39:58.792: E/AndroidRuntime(863): at dalvik.system.NativeStart.main(Native Method)
04-25 08:39:58.792: E/AndroidRuntime(863): Caused by: java.lang.ClassNotFoundException: com.zardtechnologies.mrsnakey.MrSnakey in loader dalvik.system.PathClassLoader[/data/app/com.zardtechnologies.mrsnakey-2.apk]
04-25 08:39:58.792: E/AndroidRuntime(863): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
04-25 08:39:58.792: E/AndroidRuntime(863): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
04-25 08:39:58.792: E/AndroidRuntime(863): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
04-25 08:39:58.792: E/AndroidRuntime(863): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
04-25 08:39:58.792: E/AndroidRuntime(863): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
04-25 08:39:58.792: E/AndroidRuntime(863): ... 11 more
私のマニフェストはここにあります:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.zardtechnologies.mrsnakey"
android:versionCode="1"
android:versionName="1.0" >
<application
android:debuggable="true"
android:icon="@drawable/ic_launcher"
android:label="Mr.Snakey" >
<activity
android:name=".MrSnakey"
android:configChanges="keyboard|keyboardHidden|orientation"
android:label="Mr.Snakey"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-sdk
android:minSdkVersion="3"
android:targetSdkVersion="12" />
</manifest>
私の活動はここにあります:
package com.zardtechnologies.mrsnakey;
import com.zardapps.framework.Screen;
import com.zardtechnologies.androidgames.framework.impl.AndroidGame;
public class MrSnakey extends AndroidGame {
public Screen getStartScreen() {
return new LoadingScreen(this);
}
}
私の AndroidGame ファイル
package com.zardtechnologies.androidgames.framework.impl;
import android.app.Activity;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.os.Bundle;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.view.Window;
import android.view.WindowManager;
import com.zardapps.framework.Audio;
import com.zardapps.framework.FileIO;
import com.zardapps.framework.Game;
import com.zardapps.framework.Graphics;
import com.zardapps.framework.Input;
import com.zardapps.framework.Screen;
public abstract class AndroidGame extends Activity implements Game {
AndroidFastRenderView renderView;
Graphics graphics;
Audio audio;
Input input;
FileIO fileIO;
Screen screen;
WakeLock wakeLock;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
boolean isLandscape = getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
int frameBufferWidth = isLandscape ? 480 : 320;
int frameBufferHeight = isLandscape ? 320 : 480;
Bitmap frameBuffer = Bitmap.createBitmap(frameBufferWidth,
frameBufferHeight, Config.RGB_565);
float scaleX = (float) frameBufferWidth
/ getWindowManager().getDefaultDisplay().getWidth();
float scaleY = (float) frameBufferHeight
/ getWindowManager().getDefaultDisplay().getHeight();
renderView = new AndroidFastRenderView(this, frameBuffer);
graphics = new AndroidGraphics(getAssets(), frameBuffer);
fileIO = new AndroidFileIO(getAssets());
audio = new AndroidAudio(this);
input = new AndroidInput(this, renderView, scaleX, scaleY);
screen = getStartScreen();
setContentView(renderView);
PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
wakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK,
"GLGAME");
}
public void onResume() {
super.onResume();
wakeLock.acquire();
screen.resume();
renderView.resume();
}
public void onPause() {
super.onPause();
wakeLock.release();
renderView.pause();
screen.pause();
if (isFinishing())
screen.dispose();
}
public Input getInput() {
return input;
}
public FileIO getFileIO() {
return fileIO;
}
public Graphics getGraphics() {
return graphics;
}
public Audio getAudio() {
return audio;
}
public void setScreen(Screen screen) {
if (screen == null)
throw new IllegalArgumentException("Screen must not be null");
this.screen.pause();
this.screen.dispose();
screen.resume();
screen.update(0);
this.screen = screen;
}
public Screen getCurrentScreen() {
return screen;
}
}
ああ、別のメモ私はウェブを検索し、多くの人がデバッグするように言いました.私はそれをデバッグしました、そして私はこれを得ました:
Mr.Snakey [Android Application]
DalvikVM[localhost:8631]
Thread [<1> main] (Suspended (exception RuntimeException))
ActivityThread.performLaunchActivity(ActivityThread$ActivityRecord, Intent) line: 2585
ActivityThread.handleLaunchActivity(ActivityThread$ActivityRecord, Intent) line: 2679
ActivityThread.access$2300(ActivityThread, ActivityThread$ActivityRecord, Intent) line: 125
ActivityThread$H.handleMessage(Message) line: 2033
ActivityThread$H(Handler).dispatchMessage(Message) line: 99
Looper.loop() line: 123
ActivityThread.main(String[]) line: 4627
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 521
ZygoteInit$MethodAndArgsCaller.run() line: 868
ZygoteInit.main(String[]) line: 626
NativeStart.main(String[]) line: not available [native method]
Thread [<6> Binder Thread #2] (Running)
Thread [<5> Binder Thread #1] (Running)
これを読むコツはありますか?それだけ
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]
ActivityThread$H(Handler).dispatchMessage(Message) line: 99
これらだけが「ソースを添付してください」と書かれたボックスをくれました
読んでくれてありがとう!与えられた助けに感謝します:)