views:

1228

answers:

2

My app has been running okay until the recent Froyo update. After installing the Android 2.2 SDK, I can compile my code without any errors. However, when I run it, it just force closes:

Here's the log:

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}

//////////////THE ANDROID MANIFEST FILE////

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

The main startup class is com.handyapps.easymoney.EasyMoney. I placed a breakpoint at the start of the onCreate() method but I discovered it didn't even reach there. Somehow, the application just couldn't be loaded in Android 2.2... but it works perfectly fine for all the previous Android versions. Been trying to find the cause for the past 2 days but am totally stumped!!

A: 

From ClassCastException:

Thrown when a program attempts to cast a an object to a type with which it is not compatible.

I would go through the code and check the casts I am doing.

Macarse
He has said it doesn't even reach onCreate() in the main activity, so where is he supposed to look in the code?
HXCaine
+1  A: 

Guys, I've found the solution! Just need to remove the android:name attribute from the application tag in the manifest... but the compiler should have given a warning or error.

Roland Lim
lol, I'm surprised it worked before 2.2 -- `android:name` expects a qualified class name like `com.foo.BarApplication` or just `.BarApplication`. Giving it a label-like value like `@string/app_name` is bound to fail.
Roman Nurik
even if it's supposed to fail, shouldn't there be some kind of warning instead of some cryptic exceptions? And why would a class name attribute be given a 'name' attribute name in the application tag? So misleading
Roland Lim
I was trying to find what kind of troubles will happen with my app targeted to android 1.5 (since i don't have a physical device with android 2.2) and being installed in a Froyo device, I found this exception too, im very surprised i choose the warning advice lol, thumbs up!
Jorgesys