1

我正在为桌面和安卓设备创建一个带有 libgdx 的应用程序。该应用程序在桌面(Windows)上运行良好,在冰淇淋三明治上也运行良好(在 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清单文件是:

<?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>
4

1 回答 1

0

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

于 2013-05-23T13:12:39.360 回答