gpt4 book ai didi

java - Libgdx Android 应用程序在启动时崩溃

转载 作者:行者123 更新时间:2023-12-01 04:40:02 24 4
gpt4 key购买 nike

我正在使用 libgdx 创建一个适用于桌面和 Android 设备的应用程序。该应用程序在桌面(Windows)上运行良好,在 Ice Cream Sandwich 上也运行良好(在 Droid DNA、Nexus 7 和模拟 Nexus One 上测试)。

但是,在 Droid X 或 Gingerbead 模拟器上,应用程序会立即崩溃。

什么可能导致应用程序在 Gingerbread 上崩溃,但在 ICS 上不会崩溃?

错误是:

01-27 19:48:43.387: E/AndroidRuntime(687): FATAL EXCEPTION: main
01-27 19:48:43.387: E/AndroidRuntime(687): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.ianmarkowitz.superfrenzy/com.ianmarkowitz.superfrenzy.MainActivity}: java.lang.ClassNotFoundException: com.ianmarkowitz.superfrenzy.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.ianmarkowitz.superfrenzy-1.apk]
01-27 19:48:43.387: E/AndroidRuntime(687): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569)
01-27 19:48:43.387: E/AndroidRuntime(687): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
01-27 19:48:43.387: E/AndroidRuntime(687): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
01-27 19:48:43.387: E/AndroidRuntime(687): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
01-27 19:48:43.387: E/AndroidRuntime(687): at android.os.Handler.dispatchMessage(Handler.java:99)
01-27 19:48:43.387: E/AndroidRuntime(687): at android.os.Looper.loop(Looper.java:123)
01-27 19:48:43.387: E/AndroidRuntime(687): at android.app.ActivityThread.main(ActivityThread.java:3683)
01-27 19:48:43.387: E/AndroidRuntime(687): at java.lang.reflect.Method.invokeNative(Native Method)
01-27 19:48:43.387: E/AndroidRuntime(687): at java.lang.reflect.Method.invoke(Method.java:507)
01-27 19:48:43.387: E/AndroidRuntime(687): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
01-27 19:48:43.387: E/AndroidRuntime(687): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
01-27 19:48:43.387: E/AndroidRuntime(687): at dalvik.system.NativeStart.main(Native Method)
01-27 19:48:43.387: E/AndroidRuntime(687): Caused by: java.lang.ClassNotFoundException: com.ianmarkowitz.superfrenzy.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.ianmarkowitz.superfrenzy-1.apk]
01-27 19:48:43.387: E/AndroidRuntime(687): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
01-27 19:48:43.387: E/AndroidRuntime(687): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
01-27 19:48:43.387: E/AndroidRuntime(687): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
01-27 19:48:43.387: E/AndroidRuntime(687): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
01-27 19:48:43.387: E/AndroidRuntime(687): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
01-27 19:48:43.387: E/AndroidRuntime(687): ... 11 more

我的 Android list 文件是:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ianmarkowitz.superfrenzy"
android:allowBackup="true"
android:hardwareAccelerated="true"
android:installLocation="preferExternal"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="17" />

<uses-permission android:name="android.permission.VIBRATE" />

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".MainActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:label="@string/app_name_short"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>

最佳答案

您是否在 com.ianmarkowitz.superfrenzy.MainActivity 中使用 SDK 10 之后的任何 Android API?如果 Dalvik 链接器引用不存在的类/方法,它将拒绝加载 MainActivity

关于java - Libgdx Android 应用程序在启动时崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16706710/

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