 |
BOOK: Professional Android 2 Application Development  | This is the forum to discuss the Wrox book Professional Android 2 Application Development, 2nd Edition by Reto Meier; ISBN: 978-0-470-56552-0 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Professional Android 2 Application Development section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

March 30th, 2010, 05:07 PM
|
|
Registered User
|
|
Join Date: Mar 2010
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Problem Playing Video using listings 11-4 through 11-6
In chapter 11 there is a description on how to playback video in an Android app. I am running on a Mac running OS x Snow Leopard so no Android source is available yet for debugging. I am using Eclipse and running the app in the Emulator. Created a .iso image file and loaded a video .3gp file into the image. Created an AVD with the -c option pointing to the path of the .iso image for the sdcard and the -t 2 (first tried with -t = 5 but had the same results).
Made all the changes detailed in Listing 11-4, 11-5 and 11-6. Ran a debug version of the application/project in Eclipse. The emulator started up and the application loaded successfully. But then am getting a NullPointerException in ViewRoot.draw(boolean) line: 1235. This happens with both projects, the one running Android 1.1 (avd with -t 2) and Android 2.0 (avd with -t 5).
Does anyone have any idea why this is happening? Without the source code to step through in the Eclipse debugger I'm in need of other alternatives.
Thanks,
Emanuel
|
|

April 7th, 2010, 10:25 AM
|
 |
Wrox Author
|
|
Join Date: Oct 2008
Posts: 61
Thanks: 1
Thanked 7 Times in 6 Posts
|
|
A NullPointerException in ViewRoot suggests that setContentView may not have been called within the onCreate method (or that the resource it refers to is either null or invalid).
Could you include the full logcat output around the NPE?
|
|

April 7th, 2010, 12:50 PM
|
|
Registered User
|
|
Join Date: Mar 2010
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Reto,
Here is the logcat output, thanks:
Code:
D/AndroidRuntime( 177): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
D/AndroidRuntime( 177): CheckJNI is ON
D/dalvikvm( 54): GC freed 10048 objects / 663496 bytes in 274ms
D/qemud ( 35): fdhandler_accept_event: accepting on fd 10
D/qemud ( 35): created client 0xc088 listening on fd 14
D/qemud ( 35): client_fd_receive: attempting registration for service 'sensors'
D/qemud ( 35): client_fd_receive: -> received channel id 7
D/qemud ( 35): client_registration: registration succeeded for client 7
D/vold ( 27): Accepted connection from framework
D/vold ( 27): dispatch_cmd(send_ums_status):
D/vold ( 27): dispatch_cmd(mount_volume:/sdcard):
I/vold ( 27): Evaluating dev '/devices/platform/goldfish_mmc.0/mmc_host/mmc0/mmc0:e118/block/mmcblk0' for mountable filesystems for '/sdcard'
I/ActivityManager( 54): Start proc android.process.media for broadcast com.android.providers.downloads/.DownloadReceiver: pid=184 uid=10004 gids={1006, 1015, 2001, 3003}
D/MountListener( 54): handleEvent volume_unmounted:/sdcard
D/MountListener( 54): handleEvent ums_disabled
D/MountListener( 54): handleEvent ums_disconnected
W/ResourceType( 54): Resources don't contain package for resource number 0x7f0700e5
W/ResourceType( 54): Resources don't contain package for resource number 0x7f020031
W/ResourceType( 54): Resources don't contain package for resource number 0x7f020030
W/ResourceType( 54): Resources don't contain package for resource number 0x7f050000
D/MountListener( 54): handleEvent volume_checking:/sdcard
W/ResourceType( 54): Resources don't contain package for resource number 0x7f060001
I//system/bin/fsck_msdos( 27): ** /dev/block//vold/179:0
W/ResourceType( 54): Resources don't contain package for resource number 0x7f060000
I//system/bin/fsck_msdos( 27): ** Phase 1 - Read and Compare FATs
I//system/bin/fsck_msdos( 27): Attempting to allocate 159 KB for FAT
D/MediaPlayer( 54): Couldn't open file on client side, trying server side
E/MediaPlayerService( 31): Couldn't open fd for content://settings/system/notification_sound
E/MediaPlayer( 54): Unable to to create media player
W/NotificationService( 54): error loading sound for content://settings/system/notification_sound
W/NotificationService( 54): java.io.IOException: setDataSource failed.: status=0x80000000
W/NotificationService( 54): at android.media.MediaPlayer.setDataSource(Native Method)
W/NotificationService( 54): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:699)
W/NotificationService( 54): at android.media.AsyncPlayer.startSound(AsyncPlayer.java:62)
W/NotificationService( 54): at android.media.AsyncPlayer.access$200(AsyncPlayer.java:33)
W/NotificationService( 54): at android.media.AsyncPlayer$Thread.run(AsyncPlayer.java:99)
I//system/bin/fsck_msdos( 27): Attempting to allocate 159 KB for FAT
W/ResourceType( 54): Resources don't contain package for resource number 0x7f0700e5
W/ResourceType( 54): Resources don't contain package for resource number 0x7f020031
W/ResourceType( 54): Resources don't contain package for resource number 0x7f020030
W/ResourceType( 54): Resources don't contain package for resource number 0x7f050000
W/ResourceType( 54): Resources don't contain package for resource number 0x7f060001
W/ResourceType( 54): Resources don't contain package for resource number 0x7f060000
D/HomeLoaders( 103): ----> items cloned, ready to refresh UI
I//system/bin/fsck_msdos( 27): ** Phase 2 - Check Cluster Chains
I//system/bin/fsck_msdos( 27): ** Phase 3 - Checking Directories
I//system/bin/fsck_msdos( 27): ** Phase 4 - Checking for Lost Files
I//system/bin/fsck_msdos( 27): 9 files, 10890 free (21780 clusters)
I/logwrapper( 27): /system/bin/fsck_msdos terminated by exit(0)
D/vold ( 27): Filesystem check completed OK
I/vold ( 27): Sucessfully mounted vfat filesystem 179:0 on /sdcard (safe-mode on)
D/MountListener( 54): handleEvent volume_mounted:/sdcard
D/AndroidRuntime( 177): --- registering native functions ---
D/dalvikvm( 54): GC freed 6218 objects / 334200 bytes in 163ms
I/ActivityThread( 184): Publishing provider drm: com.android.providers.drm.DrmProvider
I/ActivityThread( 184): Publishing provider media: com.android.providers.media.MediaProvider
V/MediaProvider( 184): Attached volume: internal
V/MediaProvider( 184): /sdcard volume ID: 435893533
W/NotificationService( 54): STOP command without a player
V/MediaProvider( 184): Attached volume: external
I/ActivityThread( 184): Publishing provider downloads: com.android.providers.downloads.DownloadProvider
D/dalvikvm( 103): GC freed 6117 objects / 372192 bytes in 347ms
D/OtaStartupReceiver( 100): Not a CDMA phone, no need to process OTA
W/BackupManagerService( 54): dataChanged but no participant pkg='com.android.providers.settings' uid=10000
W/BackupManagerService( 54): dataChanged but no participant pkg='com.android.providers.settings' uid=10000
I/ActivityManager( 54): Start proc com.android.email for broadcast com.android.email/com.android.exchange.BootReceiver: pid=202 uid=10008 gids={3003, 1015}
I/SurfaceFlinger( 54): Boot is finished (22280 ms)
I/ARMAssembler( 54): generated scanline__00000177:03515104_00000A01_00000000 [ 55 ipp] (79 ins) at [0x475c20:0x475d5c] in 5455001 ns
D/ActivityManager( 54): Uninstalling process com.example.launchvideo
I/ActivityManager( 54): Starting activity: Intent { flg=0x10000000 cmp=com.example.launchvideo/.LaunchVideo }
D/AndroidRuntime( 177): Shutting down VM
D/dalvikvm( 177): DestroyJavaVM waiting for non-daemon threads to exit
D/dalvikvm( 177): DestroyJavaVM shutting VM down
D/dalvikvm( 177): HeapWorker thread shutting down
D/dalvikvm( 177): HeapWorker thread has shut down
D/jdwp ( 177): JDWP shutting down net...
I/jdwp ( 177): adbd disconnected
D/dalvikvm( 177): VM cleaning up
E/AndroidRuntime( 177): ERROR: thread attach failed
D/dalvikvm( 177): LinearAlloc 0x0 used 635084 of 5242880 (12%)
I/ActivityManager( 54): Start proc com.example.launchvideo for activity com.example.launchvideo/.LaunchVideo: pid=211 uid=10025 gids={1015}
D/ddm-heap( 158): Got feature list request
D/ddm-heap( 138): Got feature list request
D/ddm-heap( 184): Got feature list request
D/ddm-heap( 121): Got feature list request
D/ddm-heap( 202): Got feature list request
I/ActivityThread( 202): Publishing provider com.android.email.provider: com.android.email.provider.EmailProvider
I/ActivityThread( 202): Publishing provider com.android.email.attachmentprovider: com.android.email.provider.AttachmentProvider
D/Exchange( 202): BootReceiver onReceive
D/EAS SyncManager( 202): !!! EAS SyncManager, onCreate
D/ddm-heap( 211): Got feature list request
D/dalvikvm( 30): GC freed 282 objects / 10784 bytes in 903ms
D/MediaScannerService( 184): start scanning volume internal
D/dalvikvm( 30): GC freed 50 objects / 2232 bytes in 283ms
D/dalvikvm( 30): GC freed 2 objects / 48 bytes in 85ms
I/ActivityManager( 54): Start proc com.svox.pico for broadcast com.svox.pico/.VoiceDataInstallerReceiver: pid=223 uid=10018 gids={}
W/ActivityThread( 211): Application com.example.launchvideo is waiting for the debugger on port 8100...
I/System.out( 211): Sending WAIT chunk
D/EAS SyncManager( 202): !!! EAS SyncManager, onStartCommand
D/EAS SyncManager( 202): !!! EAS SyncManager, stopping self
D/Eas Debug( 202): Logging:
D/EAS SyncManager( 202): !!! EAS SyncManager, onDestroy
D/ddm-heap( 223): Got feature list request
I/dalvikvm( 211): Debugger is active
I/System.out( 211): Debugger has connected
I/System.out( 211): waiting for debugger to settle...
I/System.out( 211): waiting for debugger to settle...
I/System.out( 211): waiting for debugger to settle...
I/System.out( 211): waiting for debugger to settle...
I/System.out( 211): waiting for debugger to settle...
D/MediaScanner( 184): opendir /system/media/ failed, errno: 2
D/MediaScanner( 184): prescan time: 1569ms
D/MediaScanner( 184): scan time: 10ms
D/MediaScanner( 184): postscan time: 1ms
D/MediaScanner( 184): total time: 1580ms
D/MediaScannerService( 184): done scanning volume internal
D/MediaScannerService( 184): start scanning volume external
I/System.out( 211): waiting for debugger to settle...
V/MediaScanner( 184): pruneDeadThumbnailFiles... android.database.sqlite.SQLiteCursor@43bb1348
V/MediaScanner( 184): /pruneDeadThumbnailFiles... android.database.sqlite.SQLiteCursor@43bb1348
D/MediaScanner( 184): prescan time: 56ms
D/MediaScanner( 184): scan time: 4ms
D/MediaScanner( 184): postscan time: 16ms
D/MediaScanner( 184): total time: 76ms
D/MediaScannerService( 184): done scanning volume external
I/System.out( 211): waiting for debugger to settle...
I/System.out( 211): waiting for debugger to settle...
I/System.out( 211): waiting for debugger to settle...
I/System.out( 211): waiting for debugger to settle...
I/System.out( 211): waiting for debugger to settle...
I/System.out( 211): waiting for debugger to settle...
I/System.out( 211): waiting for debugger to settle...
I/System.out( 211): waiting for debugger to settle...
I/System.out( 211): debugger has settled (1313)
W/ActivityManager( 54): Launch timeout has expired, giving up wake lock!
W/ActivityManager( 54): Activity idle timeout for HistoryRecord{43d35a30 com.example.launchvideo/.LaunchVideo}
D/AndroidRuntime( 211): Shutting down VM
W/dalvikvm( 211): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
E/AndroidRuntime( 211): Uncaught handler: thread main exiting due to uncaught exception
E/AndroidRuntime( 211): java.lang.NullPointerException
E/AndroidRuntime( 211): at com.example.launchvideo.LaunchVideo.surfaceCreated(LaunchVideo.java:34)
E/AndroidRuntime( 211): at android.view.SurfaceView.updateWindow(SurfaceView.java:454)
E/AndroidRuntime( 211): at android.view.SurfaceView.dispatchDraw(SurfaceView.java:287)
E/AndroidRuntime( 211): at android.view.ViewGroup.drawChild(ViewGroup.java:1525)
E/AndroidRuntime( 211): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1257)
E/AndroidRuntime( 211): at android.view.ViewGroup.drawChild(ViewGroup.java:1525)
E/AndroidRuntime( 211): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1257)
E/AndroidRuntime( 211): at android.view.View.draw(View.java:6539)
E/AndroidRuntime( 211): at android.widget.FrameLayout.draw(FrameLayout.java:352)
E/AndroidRuntime( 211): at android.view.ViewGroup.drawChild(ViewGroup.java:1527)
E/AndroidRuntime( 211): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1257)
E/AndroidRuntime( 211): at android.view.ViewGroup.drawChild(ViewGroup.java:1525)
E/AndroidRuntime( 211): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1257)
E/AndroidRuntime( 211): at android.view.View.draw(View.java:6539)
E/AndroidRuntime( 211): at android.widget.FrameLayout.draw(FrameLayout.java:352)
E/AndroidRuntime( 211): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1830)
E/AndroidRuntime( 211): at android.view.ViewRoot.draw(ViewRoot.java:1349)
E/AndroidRuntime( 211): at android.view.ViewRoot.performTraversals(ViewRoot.java:1114)
E/AndroidRuntime( 211): at android.view.ViewRoot.handleMessage(ViewRoot.java:1633)
E/AndroidRuntime( 211): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 211): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 211): at android.app.ActivityThread.main(ActivityThread.java:4338)
E/AndroidRuntime( 211): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 211): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 211): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
E/AndroidRuntime( 211): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
E/AndroidRuntime( 211): at dalvik.system.NativeStart.main(Native Method)
I/Process ( 54): Sending signal. PID: 211 SIG: 3
I/dalvikvm( 211): threadid=7: reacting to signal 3
E/dalvikvm( 211): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
D/dalvikvm( 54): GC freed 16024 objects / 728936 bytes in 109ms
|
|

April 7th, 2010, 02:16 PM
|
|
Registered User
|
|
Join Date: Mar 2010
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
The root cause
Seems like MediaPlayer was never instantiated due to the fact that the following line was missing from my code, do'h:
mediaPlayer = new MediaPlayer().
Only after reading the logcat output was this apparent. The stack trace in Eclipse showed the NPE elsewhere in system code.
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| Problem Chapter 11 |
Catfish001 |
BOOK: Excel 2007 VBA Programmer's Reference ISBN: 978-0-470-04643-2 |
0 |
November 10th, 2009 06:38 AM |
| Problem with chapter 11 example |
luis.filipe |
BOOK: Expert SQL Server 2005 Integration Services ISBN: 978-0-470-13411-5 |
1 |
January 5th, 2008 05:29 PM |
| chapter 11 figure 11-7 relative positioning |
pelopito |
BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 |
2 |
November 29th, 2007 06:11 AM |
| problem with chapter 11 example... |
shepholland |
BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 |
1 |
October 10th, 2004 10:12 AM |
| problem in chap 11 |
joeore |
BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 |
1 |
January 30th, 2004 04:38 PM |
|
 |