我正在使用 LibGdx 框架制作游戏。这对于 dekstop 工作正常,但是当尝试为 android 运行时会出现异常:-
12-03 10:39:46.687: E/AndroidRuntime(9487): FATAL EXCEPTION: main
12-03 10:39:46.687: E/AndroidRuntime(9487): java.lang.NoClassDefFoundError: com.inoXmobile.glowjump.SuperJumper
12-03 10:39:46.687: E/AndroidRuntime(9487): at com.inoXmobile.glowjump.GlowJupmAndroid.onCreate(GlowJupmAndroid.java:35)
12-03 10:39:46.687: E/AndroidRuntime(9487): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
12-03 10:39:46.687: E/AndroidRuntime(9487): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
12-03 10:39:46.687: E/AndroidRuntime(9487): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
12-03 10:39:46.687: E/AndroidRuntime(9487): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
12-03 10:39:46.687: E/AndroidRuntime(9487): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
12-03 10:39:46.687: E/AndroidRuntime(9487): at android.os.Handler.dispatchMessage(Handler.java:99)
12-03 10:39:46.687: E/AndroidRuntime(9487): at android.os.Looper.loop(Looper.java:130)
12-03 10:39:46.687: E/AndroidRuntime(9487): at android.app.ActivityThread.main(ActivityThread.java:3687)
12-03 10:39:46.687: E/AndroidRuntime(9487): at java.lang.reflect.Method.invokeNative(Native Method)
12-03 10:39:46.687: E/AndroidRuntime(9487): at java.lang.reflect.Method.invoke(Method.java:507)
12-03 10:39:46.687: E/AndroidRuntime(9487): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
12-03 10:39:46.687: E/AndroidRuntime(9487): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
12-03 10:39:46.687: E/AndroidRuntime(9487): at dalvik.system.NativeStart.main(Native Method)I
已将这些 jar 和 so 文件放在 android 项目 libs 文件夹中:- **1- gdx.jar
2-gdx-backend-android.jar
3-armeabi
4-armeabi-v7a**
我的 Android 活动是:-
public class GlowJupmAndroid extends AndroidApplication {
/** Called when the activity is first created. */
private PowerManager.WakeLock wl;
Bundle next;
@Override
public void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.initialize(new SuperJumper(), false);
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
wl = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK, "DoNotDimScreen");
}
@Override
protected void onResume() {
super.onResume();
wl.acquire();
}
@Override
protected void onPause() {
super.onPause();
wl.release();
}
}
我的清单文件是这样的:-
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.inoXmobile.glowjump"
android:versionCode="1"
android:versionName="1.0"
android:installLocation="auto">
<application android:icon="@drawable/icon" android:debuggable="true" android:label="@string/app_name">
<activity android:name=".GlowJupmAndroid"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation"
android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="3"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WAKE_LOCK" />
</manifest>
请任何人告诉我为什么这个异常发生了很多次我一直在尝试删除项目并尝试运行、清理和从 cod.google 下载新的 jar,但它不起作用。