Reputation: 1776
The native email application which version is 2.3 run in version 4.0, it will show the below exception:
W/dalvikvm( 1308): VFY: unable to resolve static field 31 (CONTENT_URI) in Landroid/provider/Calendar$Calendars;
D/dalvikvm( 1308): VFY: replacing opcode 0x62 at 0x0014
E/AccountManager( 1308): Listener was not previously added
W/dalvikvm( 1308): threadid=13: thread exiting with uncaught exception (group=0x40c391f8)
V/EmailProvider( 1308): EmailProvider.query: uri=content://com.screenshare.email.provider/account/2, match is 2
E/AndroidRuntime( 1308): FATAL EXCEPTION: SyncManager
E/AndroidRuntime( 1308): java.lang.NoClassDefFoundError: android.provider.Calendar$Calendars
E/AndroidRuntime( 1308): at com.screenshare.exchange.SyncManager$CalendarObserver.<init>(SyncManager.java:704)
E/AndroidRuntime( 1308): at com.screenshare.exchange.SyncManager.registerCalendarObserver(SyncManager.java:655)
E/AndroidRuntime( 1308): at com.screenshare.exchange.SyncManager.checkMailboxes(SyncManager.java:2138)
E/AndroidRuntime( 1308): at com.screenshare.exchange.SyncManager.run(SyncManager.java:1949)
E/AndroidRuntime( 1308): at java.lang.Thread.run(Thread.java:856)
Is the Calendar API removed from 4.0?? How to make the 2.3 Email application run successfully in 4.0? Or it can't fix??
Upvotes: 2
Views: 1539
Reputation: 434
To make your code run for any version of android
if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.GINGERBREAD) {
use android.provider.Calendar
}else{
use android.provider.CalendarContract
}
Upvotes: 0
Reputation: 1776
I know the reason: the Calendar Provider has been change in 4.0. In 2.3, Calendar Provider is android.provider.Calendar
and in 4.0, Calendar provider is android.provider.CalendarContract
. So it can't run successfully in 4.0 if the source code is not modified.
Upvotes: 2