p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Professional Android 2 Application Development (http://p2p.wrox.com/forumdisplay.php?f=547)
-   -   Getting Exception after the Correction -for Chapter 6 Part 2 Earthquake project (http://p2p.wrox.com/showthread.php?t=79173)

clombardo April 24th, 2010 03:17 PM

Getting Exception after the Correction -for Chapter 6 Part 2 Earthquake project
 
I posted this quested in reponse to a different post but no one has replied. Here is my problem:

When I am running the Chapter 6 part 2 (page 202) I get an exception when I click the "Preferences" button on the emulator. Here is the LogCat:




04-23 00:47:17.686: DEBUG/NetworkLocationProvider(58): onDataConnectionStateChanged 0
04-23 00:47:17.766: DEBUG/MobileDataStateTracker(58): default Received state= DISCONNECTED, old= CONNECTED, reason= radioTurnedOff, apnTypeList= default
04-23 00:47:17.818: DEBUG/NetworkStateTracker(58): setDetailed state, old =CONNECTED and new state=DISCONNECTED
04-23 00:47:18.787: DEBUG/ConnectivityService(58): ConnectivityChange for MOBILE: DISCONNECTED/DISCONNECTED
04-23 00:47:19.165: DEBUG/MobileDataStateTracker(58): default Received state= DISCONNECTED, old= DISCONNECTED, reason= gprsDetached, apnTypeList= default
04-23 00:47:19.546: DEBUG/NetworkLocationProvider(58): updateNetworkState(): Updating network state to 1
04-23 00:47:19.546: DEBUG/GpsLocationProvider(58): updateNetworkState unavailable info: NetworkInfo: type: MOBILE[UNKNOWN], state: DISCONNECTED/DISCONNECTED, reason: radioTurnedOff, extra: (none), roaming: false, failover: false, isAvailable: false
04-23 00:47:22.436: DEBUG/dalvikvm(261): Trying to load lib /system/lib/libjni_latinime.so 0x43d02bc8
04-23 00:47:22.476: DEBUG/dalvikvm(261): Added shared lib /system/lib/libjni_latinime.so 0x43d02bc8
04-23 00:47:24.827: DEBUG/dalvikvm(253): GC freed 3947 objects / 237720 bytes in 979ms
04-23 00:47:24.946: ERROR/ActivityThread(253): Failed to find provider info for android.server.checkin
04-23 00:47:24.995: WARN/Checkin(253): Can't update stat PHONE_GSM_REGISTERED: java.lang.IllegalArgumentException: Unknown URL content://android.server.checkin/stats
04-23 00:47:25.517: DEBUG/NetworkLocationProvider(58): onDataConnectionStateChanged 3
04-23 00:47:26.416: DEBUG/MobileDataStateTracker(58): default Received state= DISCONNECTED, old= DISCONNECTED, reason= (unspecified), apnTypeList= default
04-23 00:47:27.445: DEBUG/MccTable(253): updateMccMncConfiguration: mcc=310, mnc=260
04-23 00:47:27.467: DEBUG/MccTable(253): locale set to en_us
04-23 00:47:27.675: DEBUG/MccTable(253): WIFI_NUM_ALLOWED_CHANNESL set to 11
04-23 00:47:27.736: INFO/WifiService(58): WifiService trying to setNumAllowed to 11 with persist set to false
04-23 00:47:29.206: DEBUG/TelephonyProvider(253): Setting numeric '310260' to be the current operator
04-23 00:47:29.506: ERROR/ActivityThread(253): Failed to find provider info for android.server.checkin
04-23 00:47:29.536: WARN/Checkin(253): Can't update stat PHONE_GPRS_ATTEMPTED: java.lang.IllegalArgumentException: Unknown URL content://android.server.checkin/stats
04-23 00:47:29.605: DEBUG/NetworkLocationProvider(58): onDataConnectionStateChanged 3
04-23 00:47:29.786: DEBUG/MobileDataStateTracker(58): default Received state= CONNECTING, old= DISCONNECTED, reason= simLoaded, apnTypeList= *
04-23 00:47:29.866: DEBUG/NetworkStateTracker(58): setDetailed state, old =DISCONNECTED and new state=CONNECTING
04-23 00:47:29.976: DEBUG/ConnectivityService(58): ConnectivityChange for MOBILE: CONNECTING/CONNECTING
04-23 00:47:30.367: ERROR/ActivityThread(253): Failed to find provider info for android.server.checkin
04-23 00:47:30.377: WARN/Checkin(253): Can't update stat PHONE_GPRS_CONNECTED: java.lang.IllegalArgumentException: Unknown URL content://android.server.checkin/stats
04-23 00:47:30.446: DEBUG/NetworkLocationProvider(58): onDataConnectionStateChanged 3
04-23 00:47:30.715: DEBUG/MobileDataStateTracker(58): default Received state= CONNECTED, old= CONNECTING, reason= simLoaded, apnTypeList= *
04-23 00:47:30.797: DEBUG/MobileDataStateTracker(58): CONNECTED event did not supply interface name.
04-23 00:47:30.817: DEBUG/NetworkStateTracker(58): setDetailed state, old =CONNECTING and new state=CONNECTED
04-23 00:47:30.845: DEBUG/ConnectivityService(58): ConnectivityChange for MOBILE: CONNECTED/CONNECTED
04-23 00:47:30.906: VERBOSE/NetworkStateTracker(58): Setting TCP values: [4094,87380,110208,4096,16384,110208] which comes from [net.tcp.buffersize.umts]
04-23 00:47:30.967: DEBUG/MobileDataStateTracker(58): replacing old mInterfaceName (null) with null for mms
04-23 00:47:31.166: DEBUG/MobileDataStateTracker(58): replacing old mInterfaceName (null) with null for supl
04-23 00:47:31.206: DEBUG/MobileDataStateTracker(58): replacing old mInterfaceName (null) with null for dun
04-23 00:47:31.266: DEBUG/MobileDataStateTracker(58): replacing old mInterfaceName (null) with null for hipri
04-23 00:47:31.547: DEBUG/dalvikvm(240): GC freed 4507 objects / 219992 bytes in 2342ms
04-23 00:47:31.646: DEBUG/ConnectivityService(58): adding dns 10.0.2.3 for MOBILE
04-23 00:47:31.856: DEBUG/NetworkLocationProvider(58): updateNetworkState(): Updating network state to 2
04-23 00:47:31.876: DEBUG/GpsLocationProvider(58): updateNetworkState available info: NetworkInfo: type: MOBILE[UMTS], state: CONNECTED/CONNECTED, reason: simLoaded, extra: internet, roaming: false, failover: false, isAvailable: true
04-23 00:47:31.916: DEBUG/GpsLocationProvider(58): NetworkThread wait for 9223372036854775807ms
04-23 00:47:35.345: DEBUG/dalvikvm(240): GC freed 10939 objects / 493296 bytes in 362ms
04-23 00:47:38.895: DEBUG/dalvikvm(240): GC freed 17360 objects / 794568 bytes in 435ms
04-23 00:47:39.797: INFO/ARMAssembler(58): generated scanline__00000177:03515104_00001A01_00000000 [ 73 ipp] (98 ins) at [0x368c18:0x368da0] in 2367899 ns
04-23 00:47:39.867: WARN/InputManagerService(58): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$ Proxy@43cb4800
04-23 00:47:40.377: DEBUG/dalvikvm(106): GC freed 575 objects / 30440 bytes in 2313ms
04-23 00:47:43.076: DEBUG/dalvikvm(163): GC freed 1729 objects / 82424 bytes in 311ms
04-23 00:47:46.285: WARN/KeyCharacterMap(240): No keyboard for id 0
04-23 00:47:46.305: WARN/KeyCharacterMap(240): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
04-23 00:47:48.196: INFO/ActivityManager(58): Starting activity: Intent { cmp=com.paad.earthquake/.Preferences }
04-23 00:47:48.675: DEBUG/AndroidRuntime(240): Shutting down VM
04-23 00:47:48.685: WARN/dalvikvm(240): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
04-23 00:47:48.731: ERROR/AndroidRuntime(240): Uncaught handler: thread main exiting due to uncaught exception
04-23 00:47:48.896: ERROR/AndroidRuntime(240): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.paad.earthquake/com.paad.earthquake.Preferences}: android.view.InflateException: Binary XML file line #2: Error inflating class PreferencesScreen
04-23 00:47:48.896: ERROR/AndroidRuntime(240): at android.app.ActivityThread.performLaunchActivity(A ctivityThread.java:2496)
04-23 00:47:48.896: ERROR/AndroidRuntime(240): at android.app.ActivityThread.handleLaunchActivity(Ac tivityThread.java:2512)
04-23 00:47:48.896: ERROR/AndroidRuntime(240): at android.app.ActivityThread.access$2200(ActivityThr ead.java:119)
04-23 00:47:48.896: ERROR/AndroidRuntime(240): at android.app.ActivityThread$H.handleMessage(Activit yThread.java:1863)
04-23 00:47:48.896: ERROR/AndroidRuntime(240): at android.os.Handler.dispatchMessage(Handler.java:99 )
04-23 00:47:48.896: ERROR/AndroidRuntime(240): at android.os.Looper.loop(Looper.java:123)
04-23 00:47:48.896: ERROR/AndroidRuntime(240): at android.app.ActivityThread.main(ActivityThread.jav a:4363)
04-23 00:47:48.896: ERROR/AndroidRuntime(240): at java.lang.reflect.Method.invokeNative(Native Method)
04-23 00:47:48.896: ERROR/AndroidRuntime(240): at java.lang.reflect.Method.invoke(Method.java:521)
04-23 00:47:48.896: ERROR/AndroidRuntime(240): at com.android.internal.os.ZygoteInit$MethodAndArgsCa ller.run(ZygoteInit.java:860)
04-23 00:47:48.896: ERROR/AndroidRuntime(240): at com.android.internal.os.ZygoteInit.main(ZygoteInit .java:618)
04-23 00:47:48.896: ERROR/AndroidRuntime(240): at dalvik.system.NativeStart.main(Native Method)
04-23 00:47:48.896: ERROR/AndroidRuntime(240): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class PreferencesScreen
04-23 00:47:48.896: ERROR/AndroidRuntime(240): at android.preference.GenericInflater.createItemFromT ag(GenericInflater.java:441)
04-23 00:47:48.896: ERROR/AndroidRuntime(240): at android.preference.GenericInflater.inflate(Generic Inflater.java:317)
04-23 00:47:48.896: ERROR/AndroidRuntime(240): at android.preference.GenericInflater.inflate(Generic Inflater.java:263)
04-23 00:47:48.896: ERROR/AndroidRuntime(240): at android.preference.PreferenceManager.inflateFromRe source(PreferenceManager.java:254)
04-23 00:47:48.896: ERROR/AndroidRuntime(240): at android.preference.PreferenceActivity.addPreferenc esFromResource(PreferenceActivity.java:253)
04-23 00:47:48.896: ERROR/AndroidRuntime(240): at com.paad.earthquake.Preferences.onCreate(Preferenc es.java:18)
04-23 00:47:48.896: ERROR/AndroidRuntime(240): at android.app.Instrumentation.callActivityOnCreate(I nstrumentation.java:1047)
04-23 00:47:48.896: ERROR/AndroidRuntime(240): at android.app.ActivityThread.performLaunchActivity(A ctivityThread.java:2459)
04-23 00:47:48.896: ERROR/AndroidRuntime(240): ... 11 more
04-23 00:47:48.896: ERROR/AndroidRuntime(240): Caused by: java.lang.ClassNotFoundException: android.preference.PreferencesScreen in loader dalvik.system.PathClassLoader@43d02888
04-23 00:47:48.896: ERROR/AndroidRuntime(240): at dalvik.system.PathClassLoader.findClass(PathClassL oader.java:243)
04-23 00:47:48.896: ERROR/AndroidRuntime(240): at java.lang.ClassLoader.loadClass(ClassLoader.java:5 73)
04-23 00:47:48.896: ERROR/AndroidRuntime(240): at java.lang.ClassLoader.loadClass(ClassLoader.java:5 32)
04-23 00:47:48.896: ERROR/AndroidRuntime(240): at android.preference.GenericInflater.createItem(Gene ricInflater.java:375)
04-23 00:47:48.896: ERROR/AndroidRuntime(240): at android.preference.GenericInflater.onCreateItem(Ge nericInflater.java:417)
04-23 00:47:48.896: ERROR/AndroidRuntime(240): at android.preference.GenericInflater.createItemFromT ag(GenericInflater.java:428)
04-23 00:47:48.896: ERROR/AndroidRuntime(240): ... 18 more
04-23 00:47:49.137: INFO/Process(58): Sending signal. PID: 240 SIG: 3
04-23 00:47:49.156: INFO/dalvikvm(240): threadid=7: reacting to signal 3
04-23 00:47:49.317: INFO/dalvikvm(240): Wrote stack trace to '/data/anr/traces.txt'
04-23 00:47:52.317: INFO/Process(240): Sending signal. PID: 240 SIG: 9
04-23 00:47:52.607: ERROR/gralloc(58): [unregister] handle 0x3867d0 still locked (state=40000001)
04-23 00:47:52.787: INFO/ActivityManager(58): Process com.paad.earthquake (pid 240) has died.
04-23 00:47:52.796: INFO/WindowManager(58): WIN DEATH: Window{43ddf000 AtchDlg:com.paad.earthquake/com.paad.earthquake.Earthquake paused=false}
04-23 00:47:52.916: INFO/WindowManager(58): WIN DEATH: Window{43d03c58 com.paad.earthquake/com.paad.earthquake.Earthquake paused=false}
04-23 00:47:53.197: INFO/ActivityManager(58): Start proc com.paad.earthquake for activity com.paad.earthquake/.Earthquake: pid=279 uid=10026 gids={3003, 1015}
04-23 00:47:54.147: DEBUG/ddm-heap(279): Got feature list request
04-23 00:47:54.545: INFO/UsageStats(58): Unexpected resume of com.paad.earthquake while already resumed in com.paad.earthquake
04-23 00:47:54.745: INFO/ActivityManager(58): Displayed activity com.paad.earthquake/.Earthquake: 1740 ms (total 6371 ms)
04-23 00:47:55.896: WARN/InputManagerService(58): Got RemoteException sending setActive(false) notification to pid 240 uid 10026



Please help me trouble shoot this. As I have tried the corrections as given to me by previous response to this post.

Christian

Reto April 26th, 2010 06:03 AM

The problem here is that you've misspelt "PreferenceScreen" in the 2nd (and probably also the last) line of your userpreferences.xml file.

Looking at the error log it seems you've written
Code:

PreferencesScreen
where it should be
Code:

PreferenceScreen
(no plural!)


All times are GMT -4. The time now is 09:44 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.