在最近的 Froyo 更新之前,我的应用程序一直运行良好。安装 Android 2.2 SDK 后,我可以毫无错误地编译我的代码。但是,当我运行它时,它只是强制关闭:
这是日志:
05-23 10:15:13.463: DEBUG/AndroidRuntime(423): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
05-23 10:15:13.463: DEBUG/AndroidRuntime(423): CheckJNI is ON
05-23 10:15:14.193: DEBUG/AndroidRuntime(423): --- registering native functions ---
05-23 10:15:15.293: DEBUG/AndroidRuntime(423): Shutting down VM
05-23 10:15:15.303: DEBUG/dalvikvm(423): Debugger has detached; object registry had 1 entries
05-23 10:15:15.333:
INFO/AndroidRuntime(423): NOTE: attach of thread 'Binder Thread #3' failed
05-23 10:15:16.003: DEBUG/AndroidRuntime(431): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
05-23 10:15:16.013:
DEBUG/AndroidRuntime(431): CheckJNI is ON
05-23 10:15:16.273: DEBUG/AndroidRuntime(431): --- registering native functions ---
05-23 10:15:17.392: INFO/ActivityManager(59): Starting activity: Intent { act=android.intent.action.MAIN cat=
[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.handyapps.easymoney/.EasyMoney }
05-23 10:15:17.602: DEBUG/AndroidRuntime(431): Shutting down VM
05-23 10:15:17.662: DEBUG/dalvikvm(431): Debugger has detached; object registry had 1 entries
05-23 10:15:17.742: INFO/AndroidRuntime(431): NOTE: attach of thread 'Binder Thread #3' failed
05-23 10:15:17.912: INFO/ActivityManager(59): Start proc com.handyapps.easymoney for activity
com.handyapps.easymoney/.EasyMoney: pid=438 uid=10035 gids={1006, 1015}
05-23 10:15:19.032: DEBUG/AndroidRuntime(438): Shutting down VM
05-23 10:15:19.032: WARN/dalvikvm(438): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
05-23
10:15:19.062: ERROR/AndroidRuntime(438): FATAL EXCEPTION: main
05-23 10:15:19.062: ERROR/AndroidRuntime(438): java.lang.RuntimeException: Unable to instantiate application
com.handyapps.easymoney.EasyMoney: java.lang.ClassCastException: com.handyapps.easymoney.EasyMoney
05-23 10:15:19.062: ERROR/AndroidRuntime(438): at android.app.ActivityThread$PackageInfo.makeApplication
(ActivityThread.java:649)
05-23 10:15:19.062: ERROR/AndroidRuntime(438): at android.app.ActivityThread.handleBindApplication
(ActivityThread.java:4232)
05-23 10:15:19.062: ERROR/AndroidRuntime(438): at android.app.ActivityThread.access$3000(ActivityThread.java:125)
05-23 10:15:19.062: ERROR/AndroidRuntime(438): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2071)
05-23 10:15:19.062: ERROR/AndroidRuntime(438): at android.os.Handler.dispatchMessage(Handler.java:99)
05-23 10:15:19.062: ERROR/AndroidRuntime(438): at android.os.Looper.loop(Looper.java:123)
05-23 10:15:19.062: ERROR/AndroidRuntime(438): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-23 10:15:19.062: ERROR/AndroidRuntime(438): at java.lang.reflect.Method.invokeNative(Native Method)
05-23 10:15:19.062: ERROR/AndroidRuntime(438): at java.lang.reflect.Method.invoke(Method.java:521)
05-23 10:15:19.062: ERROR/AndroidRuntime(438): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:868)
05-23 10:15:19.062: ERROR/AndroidRuntime(438): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-23 10:15:19.062: ERROR/AndroidRuntime(438): at dalvik.system.NativeStart.main(Native Method)
05-23 10:15:19.062: ERROR/AndroidRuntime(438): Caused by: java.lang.ClassCastException: com.handyapps.easymoney.EasyMoney
05-23 10:15:19.062: ERROR/AndroidRuntime(438): at android.app.Instrumentation.newApplication(Instrumentation.java:957)
05-23 10:15:19.062: ERROR/AndroidRuntime(438): at android.app.Instrumentation.newApplication(Instrumentation.java:942)
05-23 10:15:19.062: ERROR/AndroidRuntime(438): at android.app.ActivityThread$PackageInfo.makeApplication
(ActivityThread.java:644)
05-23 10:15:19.062: ERROR/AndroidRuntime(438): ... 11 more
05-23 10:15:19.082: WARN/ActivityManager(59): Force finishing activity com.handyapps.easymoney/.EasyMoney
05-23 10:15:19.592: WARN/ActivityManager(59): Activity pause timeout for HistoryRecord{450018f0
com.handyapps.easymoney/.EasyMoney}
/////////////ANDROID 清单文件////
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-feature android:name="android.hardware.camera" />
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="4" />
<application android:icon="@drawable/icon"
android:name="@string/app_name" android:label="@string/app_name"
android:debuggable="false">
<activity android:name=".EasyMoney"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar"
android:launchMode="singleTask"
android:clearTaskOnLaunch="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".TranList" android:label="@string/app_name" android:theme="@android:style/Theme.Light.NoTitleBar"/>
<activity android:name=".TranEdit" android:theme="@android:style/Theme.Light.NoTitleBar" android:windowSoftInputMode="stateAlwaysHidden"/>
<activity android:name=".BillReminderEdit" android:theme="@android:style/Theme.Light.NoTitleBar" android:windowSoftInputMode="stateAlwaysHidden"/>
<activity android:name=".BillReminderList" android:launchMode="singleTop" android:theme="@android:style/Theme.Light.NoTitleBar"/>
<activity android:name=".BudgetList" android:theme="@android:style/Theme.Light.NoTitleBar"/>
<activity android:name=".BudgetEdit" android:theme="@android:style/Theme.Light.NoTitleBar" android:windowSoftInputMode="stateAlwaysHidden"/>
<activity android:name=".Search" android:theme="@style/CustomDialogTheme" android:windowSoftInputMode="stateAlwaysHidden"/>
<activity android:name=".PasscodeEntry" android:theme="@style/CustomDialogTheme" android:windowSoftInputMode="stateAlwaysHidden" android:screenOrientation="portrait"/>
<activity android:name=".AccountList" android:theme="@android:style/Theme.Light.NoTitleBar">
</activity>
<activity android:name=".AccountEdit" android:theme="@android:style/Theme.Light.NoTitleBar" android:windowSoftInputMode="stateAlwaysHidden"/>
<activity android:name=".UserSettingsEdit" android:theme="@android:style/Theme.Light.NoTitleBar" android:windowSoftInputMode="stateAlwaysHidden"/>
<activity android:name=".CurrencySettingsEdit" android:theme="@android:style/Theme.Light.NoTitleBar" android:windowSoftInputMode="stateAlwaysHidden"/>
<activity android:name=".DisplaySettingsEdit" android:theme="@android:style/Theme.Light.NoTitleBar" android:windowSoftInputMode="stateAlwaysHidden"/>
<activity android:name=".BackupSettingsEdit" android:theme="@android:style/Theme.Light.NoTitleBar" android:windowSoftInputMode="stateAlwaysHidden"/>
<activity android:name=".CategoryList" android:theme="@android:style/Theme.Light.NoTitleBar" />
<activity android:name=".CategoryEdit" android:theme="@android:style/Theme.Light.NoTitleBar" android:windowSoftInputMode="stateAlwaysHidden"/>
<activity android:name=".ExpenseByCategory" android:theme="@android:style/Theme.Light.NoTitleBar"/>
<activity android:name=".BalanceReport" android:theme="@android:style/Theme.Light.NoTitleBar"/>
<activity android:name=".MonthlyExpenseReport" android:theme="@android:style/Theme.Light.NoTitleBar"/>
<activity android:name=".MonthlyIncomeReport" android:theme="@android:style/Theme.Light.NoTitleBar"/>
<activity android:name=".MonthlyCashflowReport" android:theme="@android:style/Theme.Light.NoTitleBar"/>
<activity android:name=".PhotoList" android:theme="@android:style/Theme.Light.NoTitleBar" />
<activity android:name=".ExpenseByPayee" android:theme="@android:style/Theme.Light.NoTitleBar"/>
<activity android:name=".ExpenseBySubCategory" android:theme="@android:style/Theme.Light.NoTitleBar"/>
<service android:name="StartAlarm_Service">
<intent-filter>
<action android:name="com.handyapps.easymoney.StartAlarm_Service" />
</intent-filter>
</service>
<service android:name=".AlarmService_Service" android:process=":remote" />
<receiver android:name="StartupIntentReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
</receiver>
<receiver android:name=".WidgetProvider" android:label="@string/widget_name">
<intent-filter>
<action
android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/widget" />
</receiver>
<receiver
android:name=".WidgetProvider" android:label="@string/widget_name">
<intent-filter>
<action
android:name="android.appwidget.action.APPWIDGET_UPDATE" />
<data android:scheme="easymoney_widget" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/widget" />
</receiver>
<receiver android:name=".WidgetProvider">
<intent-filter>
<action android:name="com.handyapps.easymoney.WIDGET_CONTROL" />
<data android:scheme="easymoney_widget" />
</intent-filter>
</receiver>
</application>
主要的启动类是 com.handyapps.easymoney.EasyMoney。我在 onCreate() 方法的开头放置了一个断点,但我发现它甚至没有到达那里。不知何故,该应用程序无法在 Android 2.2 中加载……但它适用于所有以前的 Android 版本。过去两天一直在寻找原因,但我完全被难住了!!