The spinning globe application unning on the emulator works on android 1.5 as target but puts out a "force close application" error in android 2.2 target. Where should i look to find the problem ?
I have enclosed the logcat details that I get,
D/MediaScanner( 183): prescan time: 4913ms
D/MediaScanner( 183): scan time: 693ms
D/MediaScanner( 183): postscan time: 45ms
D/MediaScanner( 183): total time: 5651ms
D/MediaScannerService( 183): done scanning volume internal
I/PackageManager( 67): Removing non-system package:com.android.SpinningGlobe
I/ActivityManager( 67): Force stopping package com.android.SpinningGlobe uid=10038
D/dalvikvm( 127): GC_EXPLICIT freed 12963 objects / 655936 bytes in 168ms
D/PackageManager( 67): Scanning package com.android.SpinningGlobe
I/PackageManager( 67): Package com.android.SpinningGlobe codePath changed from /data/app/com.android.SpinningGlobe-2.apk to /data/app/com.android.SpinningGlobe-1.apk; Retaining data and using new
I/PackageManager( 67): /data/app/com.android.SpinningGlobe-1.apk changed; unpacking
D/installd( 34): DexInv: --- BEGIN '/data/app/com.android.SpinningGlobe-1.apk' ---
D/dalvikvm( 255): DexOpt: load 214ms, verify 229ms, opt 5ms
D/installd( 34): DexInv: --- END '/data/app/com.android.SpinningGlobe-1.apk' success)---
W/PackageManager( 67): Code path for pkg : com.android.SpinningGlobe changing from /data/app/com.android.SpinningGlobe-2.apk to /data/app/com.android.SpinningGlobe-1.apk
W/PackageManager( 67): Resource path for pkg : com.android.SpinningGlobe changing from /data/app/com.android.SpinningGlobe-2.apk to /data/app/com.android.SpinningGlobe-1.apk
I/ActivityManager( 67): Force stopping package com.android.SpinningGlobe uid=10038
D/PackageManager( 67): Activities: com.android.SpinningGlobe.GLApp
I/installd( 34): move /data/dalvik-cache/data#app#com.android.SpinningGlobe-1.apk#classes.dex -> /data/dalvik-cache/data#app#com.android.SpinningGlobe-1.apk#classes.dex
D/PackageManager( 67): New package installed in /data/app/com.android.SpinningGlobe-1.apk
I/ActivityManager( 67): Force stopping package com.android.SpinningGlobe uid=10038
I/ActivityManager( 67): Start proc com.svox.pico for broadcast com.svox.pico/.VoiceDataInstallerReceiver: pid=256 uid=10028 gids={}
D/dalvikvm( 167): GC_EXPLICIT freed 3943 objects / 244424 bytes in 1708ms
D/dalvikvm( 67): GC_EXPLICIT freed 7297 objects / 468432 bytes in 667ms
W/RecognitionManagerService( 67): no available voice recognition services found
I/ActivityThread( 256): Publishing provider com.svox.pico.providers.SettingsProvider: com.svox.pico.providers.SettingsProvider
I/installd( 34): unlink /data/dalvik-cache/data#app#com.android.SpinningGlobe-2.apk#classes.dex
D/AndroidRuntime( 118): Shutting down VM
D/jdwp ( 118): adbd disconnected
I/AndroidRuntime( 118): NOTE: attach of thread 'Binder Thread #3' failed
D/AndroidRuntime( 266):
D/AndroidRuntime( 266): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
D/AndroidRuntime( 266): CheckJNI is ON
D/AndroidRuntime( 266): --- registering native functions ---
I/ActivityManager( 67): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.android.SpinningGlobe/.GLApp }
D/AndroidRuntime( 266): Shutting down VM
D/jdwp ( 266): adbd disconnected
I/AndroidRuntime( 266): NOTE: attach of thread 'Binder Thread #3' failed
I/ActivityManager( 67): Start proc com.android.SpinningGlobe for activity com.android.SpinningGlobe/.GLApp: pid=273 uid=10038 gids={1015}
I/ARMAssembler( 67): generated scanline__00000077:03545404_00000004_00000000 [ 47 ipp] (67 ins) at [0x32b4a0:0x32b5ac] in 3627836 ns
D/libEGL ( 273): egl.cfg not found, using default config
D/libEGL ( 273): loaded /system/lib/egl/libGLES_android.so
D/dalvikvm( 273): GC_EXTERNAL_ALLOC freed 839 objects / 59328 bytes in 151ms
W/dalvikvm( 273): threadid=7: thread exiting with uncaught exception (group=0x4001d800)
I/ActivityManager( 67): Displayed activity com.android.SpinningGlobe/.GLApp: 4870 ms (total 4870 ms)
E/AndroidRuntime( 273): FATAL EXCEPTION: GLThread 8
E/AndroidRuntime( 273): java.lang.IndexOutOfBoundsException
E/AndroidRuntime( 273): at java.nio.IntArrayBuffer.get(IntArrayBuffer.java:63)
E/AndroidRuntime( 273): at com.android.SpinningGlobe.GLRenderer.onDrawFrame(GLRenderer.java:105)
E/AndroidRuntime( 273): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1332)
E/AndroidRuntime( 273): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1116)
W/ActivityManager( 67): Force finishing activity com.android.SpinningGlobe/.GLApp
I/ARMAssembler( 67): generated scanline__00000077:03515104_00000000_00000000 [ 33 ipp] (47 ins) at [0x33f9a8:0x33fa64] in 1258819 ns
Any insights on where the problem could be ?
You should look at the log from the emulator.
You can get this on the command line using:
adb logcat
Or if you're using the ADT Plugin for Eclipse the log is visible there. If you can't see it select Window ▶ Show View ▶ Other... and then select Android ▶ LogCat.
It's probably also worth reading the Debugging page in the Android Developer Documentation.
Recompile it under 2.2 and look for deprecated warnings
Related
I have a question: is there somebody that use MVVMCross 3.5.1 with Api level android 21 and xamarin studio 5.9.3? I have a problem: I reference mvvmcross in an android app. I have a splashscreen and a firstview. When I tried to start with emulator I don't have any problem with level 15 emulator but when I tried it with the last version (Api 21) the app after splashscreen is closed without any error (not open the firstview).
Is there a solution?
UPDATE
I tried with logcat. In the following I attached the log:
W/AudioTrack( 394): AUDIO_OUTPUT_FLAG_FAST denied by client
I/ActivityManager( 394): START u0 {act=android.intent.action.MAIN cat=[android.
intent.category.LAUNCHER] flg=0x10000000 cmp=com.nowhere.nowhere/md51f5aeae0dbe3
fa3acab67292d41114d1.SplashScreen (has extras)} from uid 10007 on display 0
I/Choreographer( 824): Skipped 67 frames! The application may be doing too muc
h work on its main thread.
I/art ( 1716): Not late-enabling -Xcheck:jni (already on)
I/ActivityManager( 394): Start proc com.nowhere.nowhere for activity com.nowher
e.nowhere/md51f5aeae0dbe3fa3acab67292d41114d1.SplashScreen: pid=1716 uid=10056 g
ids={50056, 9997, 3003} abi=armeabi-v7a
I/Choreographer( 394): Skipped 32 frames! The application may be doing too muc
h work on its main thread.
F/MonoDroid( 1716): shared runtime initialization error: dlopen failed: library
"/data/app/Mono.Android.DebugRuntime-1/lib/arm/lib/libmonosgen-2.0.so" not found
I/Zygote ( 66): Process 1716 exited cleanly (1)
I/ActivityManager( 394): Process com.nowhere.nowhere (pid 1716) has died
I/art ( 1731): Not late-enabling -Xcheck:jni (already on)
I/ActivityManager( 394): Start proc com.nowhere.nowhere for activity com.nowher
e.nowhere/md51f5aeae0dbe3fa3acab67292d41114d1.SplashScreen: pid=1731 uid=10056 g
ids={50056, 9997, 3003} abi=armeabi-v7a
F/MonoDroid( 1731): shared runtime initialization error: dlopen failed: library
"/data/app/Mono.Android.DebugRuntime-1/lib/arm/lib/libmonosgen-2.0.so" not found
I/Zygote ( 66): Process 1731 exited cleanly (1)
I/ActivityManager( 394): Process com.nowhere.nowhere (pid 1731) has died
I/art ( 1746): Not late-enabling -Xcheck:jni (already on)
I/ActivityManager( 394): Start proc com.nowhere.nowhere for activity com.nowher
e.nowhere/md51f5aeae0dbe3fa3acab67292d41114d1.SplashScreen: pid=1746 uid=10056 g
ids={50056, 9997, 3003} abi=armeabi-v7a
F/MonoDroid( 1746): shared runtime initialization error: dlopen failed: library
"/data/app/Mono.Android.DebugRuntime-1/lib/arm/lib/libmonosgen-2.0.so" not found
I/Zygote ( 66): Process 1746 exited cleanly (1)
I/ActivityManager( 394): Process com.nowhere.nowhere (pid 1746) has died
W/ActivityManager( 394): Force removing ActivityRecord{27f513c9 u0 com.nowhere.
nowhere/md51f5aeae0dbe3fa3acab67292d41114d1.SplashScreen t8}: app died, no saved
state
W/WindowManager( 394): Failed looking up window
W/WindowManager( 394): java.lang.IllegalArgumentException: Requested window and
roid.view.ViewRootImpl$W#3c7a1def does not exist
W/WindowManager( 394): at com.android.server.wm.WindowManagerService.wi
ndowForClientLocked(WindowManagerService.java:8412)
W/WindowManager( 394): at com.android.server.wm.WindowManagerService.wi
ndowForClientLocked(WindowManagerService.java:8403)
W/WindowManager( 394): at com.android.server.wm.WindowManagerService.re
moveWindow(WindowManagerService.java:2558)
W/WindowManager( 394): at com.android.server.wm.Session.remove(Session.
java:186)
W/WindowManager( 394): at android.view.ViewRootImpl.dispatchDetachedFro
mWindow(ViewRootImpl.java:2920)
W/WindowManager( 394): at android.view.ViewRootImpl.doDie(ViewRootImpl.
java:5390)
W/WindowManager( 394): at android.view.ViewRootImpl$ViewRootHandler.han
dleMessage(ViewRootImpl.java:3223)
W/WindowManager( 394): at android.os.Handler.dispatchMessage(Handler.ja
va:102)
W/WindowManager( 394): at android.os.Looper.loop(Looper.java:135)
W/WindowManager( 394): at android.os.HandlerThread.run(HandlerThread.ja
va:61)
W/WindowManager( 394): at com.android.server.ServiceThread.run(ServiceT
hread.java:46)
W/InputMethodManagerService( 394): Window already focused, ignoring focus gain
of: com.android.internal.view.IInputMethodClient$Stub$Proxy#14f4aa0b attribute=n
ull, token = android.os.BinderProxy#5c9e508
I/Choreographer( 824): Skipped 56 frames! The application may be doing too muc
h work on its main thread.
D/TaskPersister( 394): removeObsoleteFile: deleting file=8_task.xml
UPDATE 2
The bind does not work. Inside the view..
UPDATE 3
I put the code in this repo:
https://onedrive.live.com/redir?resid=1E563B1D1AD8A1C!15847&authkey=!AII01sfuzToQiUQ&ithint=file%2czip
I used this configuration for the test:
1. Nexus 5,
2. Android 5.0-API Level 21,
3. CPU/ABI, I have chosen Google APIs Intel Atom(x86_64),
4. Use Host GPU.
UPDATE 4
new link for code: http://1drv.ms/1MZWf45
Thanks
Alessandro
I found the problem. The problem was the emulator. I tried to change the configuration and now run without problem.
Thanks
Al.
Why is the debug window empty debugging an Android app that does not include a MAIN and LAUNCH activity, but only a receiver? Is it normal or there is something wrong?
When I launch the app in debug mode this is the LogCat:
10-24 13:02:52.998: D/AndroidRuntime(5782): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
10-24 13:02:52.998: D/AndroidRuntime(5782): CheckJNI is ON
10-24 13:02:53.108: D/dalvikvm(5782): Trying to load lib libjavacore.so 0x0
10-24 13:02:53.118: D/dalvikvm(5782): Added shared lib libjavacore.so 0x0
10-24 13:02:53.159: D/dalvikvm(5782): Trying to load lib libnativehelper.so 0x0
10-24 13:02:53.168: D/dalvikvm(5782): Added shared lib libnativehelper.so 0x0
10-24 13:02:54.324: D/AndroidRuntime(5782): Calling main entry com.android.commands.pm.Pm
10-24 13:02:54.398: D/AndroidRuntime(5782): Shutting down VM
10-24 13:02:54.418: D/dalvikvm(5782): GC_CONCURRENT freed 102K, 78% free 466K/2048K, paused 1ms+3ms, total 22ms
10-24 13:02:54.448: D/dalvikvm(5782): Debugger has detached; object registry had 1 entries
10-24 13:04:07.651: E/ThrottleService(159): problem during onPollAlarm: java.lang.IllegalStateException: problem parsing stats: java.io.FileNotFoundException: /proc/net/xt_qtaguid/iface_stat_all: open failed: ENOENT (No such file or directory)
10-24 13:05:07.188: E/MP3Extractor(39): Unable to resync. Signalling end of stream.
10-24 13:05:08.118: I/AudioService(159): AudioFocus abandonAudioFocus() from android.media.AudioManager#412af538
10-24 13:06:00.370: D/dalvikvm(220): GC_CONCURRENT freed 386K, 57% free 9099K/20743K, paused 74ms+10ms, total 195ms
This is the Console window
[2012-10-24 15:02:53 - SMSApp] ------------------------------
[2012-10-24 15:02:53 - SMSApp] Android Launch!
[2012-10-24 15:02:53 - SMSApp] adb is running normally.
[2012-10-24 15:02:53 - SMSApp] No Launcher activity found!
[2012-10-24 15:02:53 - SMSApp] The launch will only sync the application package on the device!
[2012-10-24 15:02:53 - SMSApp] Performing sync
[2012-10-24 15:02:53 - SMSApp] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD 'NFC-Smartphone-1'
[2012-10-24 15:02:55 - SMSApp] Application already deployed. No need to reinstall.
[2012-10-24 15:02:55 - SMSApp] \SMSApp\bin\SMSApp.apk installed on device
[2012-10-24 15:02:55 - SMSApp] Done!
As you can see the application was already installed on the emulator, but the same issue is present when the application is installed for the first time.
Let me know whether it is useful to see also the code.
I tried with a slightly different version of the same app just to force Eclipse to reinstall the app in the emulator (added a space). This is the LogCat of the reinstallation:
10-25 12:43:14.628: D/AndroidRuntime(701): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
10-25 12:43:14.628: D/AndroidRuntime(701): CheckJNI is ON
10-25 12:43:14.687: D/dalvikvm(701): Trying to load lib libjavacore.so 0x0
10-25 12:43:14.707: D/dalvikvm(701): Added shared lib libjavacore.so 0x0
10-25 12:43:14.747: D/dalvikvm(701): Trying to load lib libnativehelper.so 0x0
10-25 12:43:14.747: D/dalvikvm(701): Added shared lib libnativehelper.so 0x0
10-25 12:43:15.647: D/AndroidRuntime(701): Calling main entry com.android.commands.pm.Pm
10-25 12:43:15.707: W/ActivityManager(148): No content provider found for permission revoke: file:///data/local/tmp/SMSApp.apk
10-25 12:43:15.737: W/ActivityManager(148): No content provider found for permission revoke: file:///data/local/tmp/SMSApp.apk
10-25 12:43:15.917: I/PackageManager(148): Removing non-system package:com.storassa.android.smsapp
10-25 12:43:15.917: I/ActivityManager(148): Force stopping package com.storassa.android.smsapp uid=10044
10-25 12:43:15.967: I/dalvikvm(148): Jit: resizing JitTable from 4096 to 8192
10-25 12:43:16.088: I/PackageManager(148): Package com.storassa.android.smsapp codePath changed from /data/app/com.storassa.android.smsapp-2.apk to /data/app/com.storassa.android.smsapp-1.apk; Retaining data and using new
10-25 12:43:16.098: I/PackageManager(148): Running dexopt on: com.storassa.android.smsapp
10-25 12:43:16.948: D/dalvikvm(715): DexOpt: load 124ms, verify+opt 526ms, 730780 bytes
10-25 12:43:16.977: I/ActivityManager(148): Force stopping package com.storassa.android.smsapp uid=10044
10-25 12:43:16.977: W/PackageManager(148): Code path for pkg : com.storassa.android.smsapp changing from /data/app/com.storassa.android.smsapp-2.apk to /data/app/com.storassa.android.smsapp-1.apk
10-25 12:43:16.977: W/PackageManager(148): Resource path for pkg : com.storassa.android.smsapp changing from /data/app/com.storassa.android.smsapp-2.apk to /data/app/com.storassa.android.smsapp-1.apk
10-25 12:43:17.067: D/PackageManager(148): New package installed in /data/app/com.storassa.android.smsapp-1.apk
10-25 12:43:17.337: D/dalvikvm(148): GC_CONCURRENT freed 664K, 8% free 11375K/12231K, paused 77ms+12ms, total 180ms
10-25 12:43:17.337: D/dalvikvm(148): WAIT_FOR_CONCURRENT_GC blocked 100ms
Another tips: no saved filters appears in LogCat.
I wonder if you can help me with this error.
I am running a fresh fully updated install of windows 7 with
Visual studio 2010 Professional in trial mode.
In Visual Studio I create a new OpenGl Mono for Android Application
using the built in template.
I compile and run the application.
The emulator boots (I am running API_8) EMU.
The application starts and then aborts.
(In the emulator I get a black screen which quickly closes.)
Same thing happens if I do similar using the Mono Develop IDE
and or the other templates.
Here is a dump of the error message (I cannot find much info on google)
It looks like the error is related to the load library fail.
Thanks
// DUMP
03-05 23:23:47.464 D/AndroidRuntime( 418):
03-05 23:23:47.464 D/AndroidRuntime( 418): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
03-05 23:23:47.464 D/AndroidRuntime( 418): CheckJNI is ON
03-05 23:23:47.574 D/AndroidRuntime( 418): --- registering native functions ---
03-05 23:23:48.034 I/ActivityManager( 60): Start proc OpenGLApplication1.OpenGLApplication1 for broadcast OpenGLApplication1.OpenGLApplication1/mono.android.Seppuku: pid=424 uid=10038 gids={3003, 1015}
03-05 23:23:48.164 I/ActivityThread( 424): Publishing provider OpenGLApplication1.OpenGLApplication1.__mono_init__: mono.MonoRuntimeProvider
03-05 23:23:48.174 D/dalvikvm( 424): Trying to load lib /data/data/OpenGLApplication1.OpenGLApplication1/lib/libmonodroid.so 0x44e7f010
03-05 23:23:48.174 D/dalvikvm( 424): Added shared lib /data/data/OpenGLApplication1.OpenGLApplication1/lib/libmonodroid.so 0x44e7f010
03-05 23:23:48.184 F/MonoDroid( 424): shared runtime initialization error: Cannot load library: load_library[1083]: Library '/data/data/Mono.Android.DebugRuntime/lib/libmonosgen-2.0.so' not found
03-05 23:23:48.204 I/ActivityManager( 60): Process OpenGLApplication1.OpenGLApplication1 (pid 424) has died.
03-05 23:23:48.214 D/AndroidRuntime( 418): Shutting down VM
03-05 23:23:48.214 D/jdwp ( 418): adbd disconnected
03-05 23:23:48.624 D/AndroidRuntime( 432):
03-05 23:23:48.624 D/AndroidRuntime( 432): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
03-05 23:23:48.624 D/AndroidRuntime( 432): CheckJNI is ON
03-05 23:23:48.734 D/AndroidRuntime( 432): --- registering native functions ---
03-05 23:23:49.173 I/ActivityManager( 60): Start proc OpenGLApplication1.OpenGLApplication1 for broadcast OpenGLApplication1.OpenGLApplication1/mono.android.Seppuku: pid=438 uid=10038 gids={3003, 1015}
03-05 23:23:49.294 I/ActivityThread( 438): Publishing provider OpenGLApplication1.OpenGLApplication1.__mono_init__: mono.MonoRuntimeProvider
03-05 23:23:49.303 D/dalvikvm( 438): Trying to load lib /data/data/OpenGLApplication1.OpenGLApplication1/lib/libmonodroid.so 0x44e7f010
03-05 23:23:49.303 D/dalvikvm( 438): Added shared lib /data/data/OpenGLApplication1.OpenGLApplication1/lib/libmonodroid.so 0x44e7f010
03-05 23:23:49.314 F/MonoDroid( 438): shared runtime initialization error: Cannot load library: load_library[1083]: Library '/data/data/Mono.Android.DebugRuntime/lib/libmonosgen-2.0.so' not found
03-05 23:23:49.334 I/ActivityManager( 60): Process OpenGLApplication1.OpenGLApplication1 (pid 438) has died.
03-05 23:23:49.344 D/AndroidRuntime( 432): Shutting down VM
03-05 23:23:49.344 D/jdwp ( 432): adbd disconnected
03-05 23:23:50.333 D/AndroidRuntime( 447):
03-05 23:23:50.333 D/AndroidRuntime( 447): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
03-05 23:23:50.333 D/AndroidRuntime( 447): CheckJNI is ON
03-05 23:23:50.443 D/AndroidRuntime( 447): --- registering native functions ---
03-05 23:23:50.873 I/ActivityManager( 60): Starting activity: Intent { act=android.intent.action.MAIN flg=0x10000000 cmp=OpenGLApplication1.OpenGLApplication1/openglapplication1.Activity1 }
03-05 23:23:50.893 I/ActivityManager( 60): Start proc OpenGLApplication1.OpenGLApplication1 for activity OpenGLApplication1.OpenGLApplication1/openglapplication1.Activity1: pid=453 uid=10038 gids={3003, 1015}
03-05 23:23:50.923 D/AndroidRuntime( 447): Shutting down VM
03-05 23:23:50.923 D/jdwp ( 447): adbd disconnected
03-05 23:23:50.953 I/AndroidRuntime( 447): NOTE: attach of thread 'Binder Thread #3' failed
03-05 23:23:51.173 I/ActivityThread( 453): Publishing provider OpenGLApplication1.OpenGLApplication1.__mono_init__: mono.MonoRuntimeProvider
03-05 23:23:51.223 D/dalvikvm( 453): Trying to load lib /data/data/OpenGLApplication1.OpenGLApplication1/lib/libmonodroid.so 0x44e7eef0
03-05 23:23:51.223 D/dalvikvm( 453): Added shared lib /data/data/OpenGLApplication1.OpenGLApplication1/lib/libmonodroid.so 0x44e7eef0
03-05 23:23:51.263 F/MonoDroid( 453): shared runtime initialization error: Cannot load library: load_library[1083]: Library '/data/data/Mono.Android.DebugRuntime/lib/libmonosgen-2.0.so' not found
03-05 23:23:51.283 I/ActivityManager( 60): Process OpenGLApplication1.OpenGLApplication1 (pid 453) has died.
03-05 23:23:51.293 I/UsageStats( 60): Unexpected resume of com.android.launcher while already resumed in OpenGLApplication1.OpenGLApplication1
03-05 23:23:51.423 W/InputManagerService( 60): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#45104b68
The issue is from the newer versions of mono where libmonosgen-2.0 does not get installed automatically. The path that you will see in which it fails is actually a simlink for the library. What you have to do is manually or through a non-mono apk, create the following:
A folder with your package name in /data/app-lib/
in the folder you will have to push the libmonosgen-2.0.so (and libmonodroid.so if needed)
After this is done you have to navigate to data/data/your.package.name and create a simlink from lib -> the folder you created previously. the command to use is ln -s.
I have noticed that in some cases the simlink exists, but is pointing to a false location.
I had to do this manually and it would not survive a factory reset. A colleugue of mine actually did this the non-mono apk path which does everything for him when ever the provisioning app executes on first launch.
Try going to the project properties and turn off "fast deployment". Then manually remove your app from the emu/device, and try again.
Another possibility is that you don't have enough free space on your device. The problem isn't in your package (OpenGLApplication1), the problem is from installing the Mono.Android.DebugRuntime package, as /data/data/Mono.Android.DebugRuntime/lib/libmonosgen-2.0.so doesn't exist.
I would suggest looking through the adb logcat log, and see if something like the following is present:
W/NativeHelper( 98): Failed to cache package shared libs
W/NativeHelper( 98): java.io.IOException: Couldn't create cached binary /data/data/Mono.Android.DebugRuntime/lib/libmonosgen-2.0.so in /data/data/Mono.Android.DebugRuntime/lib
W/NativeHelper( 98): at com.android.internal.content.NativeLibraryHelper.copyNativeBinaryLI(NativeLibraryHelper.java:289)
If messages like the above are present, remove the Mono.Android.DebugRuntime package (adb uninstall Mono.Android.DebugRuntime), remove some extra apps from your device (to free up space), and try re-installing your app from the IDE.
I am getting a problem in implementing a simple HelloGoogleMaps tutorial given at http://developer.android.com/resources/tutorials/views/hello-mapview.html
The problem is that everything seems fine, but on running the code, only the grid and google logo appears, also if I add another layer of markers, the markers show up but not the underlying map.
There is internet connection in the emulator as on all the other applications network is connected.
Somebody please help me.
The display on the console is :
[2011-10-19 18:17:21 - helloGoogleMaps] ------------------------------
[2011-10-19 18:17:21 - helloGoogleMaps] Android Launch!
[2011-10-19 18:17:21 - helloGoogleMaps] adb is running normally.
[2011-10-19 18:17:21 - helloGoogleMaps] Performing c.om.maps.my.HelloGoogleMapsActivity activity launch
[2011-10-19 18:17:21 - helloGoogleMaps] Automatic Target Mode: launching new emulator with compatible AVD 'maps'
[2011-10-19 18:17:21 - helloGoogleMaps] Launching a new emulator with Virtual Device 'maps'
[2011-10-19 18:17:29 - helloGoogleMaps] New emulator found: emulator-5554
[2011-10-19 18:17:29 - helloGoogleMaps] Waiting for HOME ('android.process.acore') to be launched...
[2011-10-19 18:18:51 - helloGoogleMaps] HOME is up on device 'emulator-5554'
[2011-10-19 18:18:51 - helloGoogleMaps] Uploading helloGoogleMaps.apk onto device 'emulator-5554'
[2011-10-19 18:18:51 - helloGoogleMaps] Installing helloGoogleMaps.apk...
[2011-10-19 18:19:35 - helloGoogleMaps] Success!
[2011-10-19 18:19:35 - helloGoogleMaps] Starting activity c.om.maps.my.HelloGoogleMapsActivity on device emulator-5554
[2011-10-19 18:19:38 - helloGoogleMaps] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=c.om.maps.my/.HelloGoogleMapsActivity }
[2011-10-19 18:41:48 - helloGoogleMaps] ------------------------------
The last portion of Log cat ouyputs ::
10-19 19:56:52.357: INFO/ActivityManager(70): Start proc com.google.android.apps.maps for broadcast com.google.android.apps.maps/com.google.android.location.internal.NlpPackageUpdateReceiver: pid=346 uid=10018 gids={3003, 1015}
10-19 19:56:52.787: DEBUG/dalvikvm(182): GC_EXPLICIT freed 292K, 49% free 2956K/5703K, external 1625K/2137K, paused 672ms
10-19 19:56:53.147: WARN/RecognitionManagerService(70): no available voice recognition services found
10-19 19:56:54.248: DEBUG/dalvikvm(70): GC_EXPLICIT freed 784K, 45% free 4854K/8711K, external 4373K/5461K, paused 290ms
10-19 19:56:54.347: INFO/ActivityThread(346): Pub com.google.android.maps.LocalSuggestionProvider: com.google.googlenav.provider.LocalSuggestionProvider
10-19 19:56:54.357: INFO/ActivityThread(346): Pub com.google.android.maps.LayerInfoProvider: com.google.googlenav.layer.LayerInfoProvider
10-19 19:56:54.377: INFO/installd(35): unlink /data/dalvik-cache/data#app#c.om.maps.my-1.apk#classes.dex
10-19 19:56:54.438: DEBUG/AndroidRuntime(202): Shutting down VM
10-19 19:56:54.457: DEBUG/dalvikvm(202): GC_CONCURRENT freed 100K, 72% free 294K/1024K, external 0K/0K, paused 3ms+1ms
10-19 19:56:54.479: DEBUG/jdwp(202): adbd disconnected
10-19 19:56:54.497: INFO/AndroidRuntime(202): NOTE: attach of thread 'Binder Thread #3' failed
10-19 19:56:54.587: INFO/ActivityThread(346): Pub com.google.android.maps.TrafficProvider: com.google.googlenav.appwidget.traffic.TrafficProvider
10-19 19:56:54.587: INFO/ActivityThread(346): Pub com.google.android.maps.SuggestionProvider: com.google.googlenav.suggest.android.SuggestProvider
10-19 19:56:54.637: INFO/ActivityThread(346): Pub com.google.android.maps.SearchHistoryProvider: com.google.googlenav.provider.SearchHistoryProvider
10-19 19:56:54.657: INFO/ActivityThread(346): Pub com.google.android.maps.NavigationAvailabilityProvider: com.google.googlenav.provider.NavigationAvailabilityProvider
10-19 19:56:55.327: INFO/ActivityThread(346): Pub com.google.android.maps.StarredItemProvider: com.google.googlenav.provider.StarredItemProvider
10-19 19:56:55.739: DEBUG/dalvikvm(346): GC_CONCURRENT freed 835K, 49% free 3476K/6727K, external 1625K/2137K, paused 8ms+8ms
10-19 19:56:56.337: INFO/ActivityManager(70): Start proc com.svox.pico for broadcast com.svox.pico/.VoiceDataInstallerReceiver: pid=362 uid=10010 gids={}
10-19 19:56:56.527: DEBUG/AndroidRuntime(360): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
10-19 19:56:56.527: DEBUG/AndroidRuntime(360): CheckJNI is ON
10-19 19:56:57.397: INFO/ActivityThread(362): Pub com.svox.pico.providers.SettingsProvider: com.svox.pico.providers.SettingsProvider
10-19 19:56:57.548: DEBUG/GTalkService(204): handlePackageInstalled: re-initialize providers
10-19 19:56:57.557: DEBUG/GTalkService(204): [RawStanzaProvidersMgr] ##### searchProvidersFromIntent
10-19 19:56:57.587: DEBUG/GTalkService(204): [RawStanzaProvidersMgr] no intent receivers found
10-19 19:56:58.417: DEBUG/AndroidRuntime(360): Calling main entry com.android.commands.am.Am
10-19 19:56:58.569: INFO/ActivityManager(70): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=c.om.maps.my/.HelloGoogleMapsActivity } from pid 360
10-19 19:56:58.807: DEBUG/AndroidRuntime(360): Shutting down VM
10-19 19:56:58.856: DEBUG/dalvikvm(360): GC_CONCURRENT freed 101K, 69% free 318K/1024K, external 0K/0K, paused 1ms+32ms
10-19 19:56:58.856: INFO/AndroidRuntime(360): NOTE: attach of thread 'Binder Thread #3' failed
10-19 19:56:58.866: INFO/ActivityManager(70): Start proc c.om.maps.my for activity c.om.maps.my/.HelloGoogleMapsActivity: pid=378 uid=10038 gids={3003, 1015}
10-19 19:56:58.877: DEBUG/jdwp(360): adbd disconnected
10-19 19:56:59.367: DEBUG/dalvikvm(33): GC_EXPLICIT freed 11K, 50% free 2719K/5379K, external 1625K/2137K, paused 475ms
10-19 19:56:59.707: DEBUG/dalvikvm(33): GC_EXPLICIT freed <1K, 50% free 2719K/5379K, external 1625K/2137K, paused 306ms
10-19 19:56:59.966: DEBUG/dalvikvm(33): GC_EXPLICIT freed <1K, 50% free 2719K/5379K, external 1625K/2137K, paused 246ms
10-19 19:57:00.237: WARN/ActivityManager(70): finishReceiver called but no pending broadcasts
10-19 19:57:01.737: DEBUG/dalvikvm(378): GC_CONCURRENT freed 1168K, 54% free 3144K/6727K, external 1626K/2137K, paused 7ms+7ms
10-19 19:57:02.187: DEBUG/dalvikvm(378): GC_CONCURRENT freed 529K, 51% free 3304K/6727K, external 1626K/2137K, paused 9ms+9ms
10-19 19:57:02.838: INFO/MapActivity(378): Handling network change notification:CONNECTED
10-19 19:57:02.847: ERROR/MapActivity(378): Couldn't get connection factory client
10-19 19:57:03.177: DEBUG/dalvikvm(378): GC_CONCURRENT freed 810K, 54% free 3121K/6727K, external 2046K/2137K, paused 6ms+11ms
10-19 19:57:03.217: INFO/ActivityManager(70): Displayed c.om.maps.my/.HelloGoogleMapsActivity: +4s421ms
10-19 19:57:04.397: VERBOSE/MediaProvider(257): Attached volume: external
10-19 19:57:04.797: VERBOSE/MediaScanner(257): pruneDeadThumbnailFiles... android.database.sqlite.SQLiteCursor#405c3dd8
10-19 19:57:04.797: VERBOSE/MediaScanner(257): /pruneDeadThumbnailFiles... android.database.sqlite.SQLiteCursor#405c3dd8
10-19 19:57:04.817: DEBUG/MediaScanner(257): prescan time: 321ms
10-19 19:57:04.817: DEBUG/MediaScanner(257): scan time: 14ms
10-19 19:57:04.817: DEBUG/MediaScanner(257): postscan time: 57ms
10-19 19:57:04.827: DEBUG/MediaScanner(257): total time: 392ms
10-19 19:57:04.838: DEBUG/MediaScannerService(257): done scanning volume external
10-19 19:57:14.308: INFO/InputReader(70): Device reconfigured: id=0x0, name=qwerty2, display size is now 480x800
10-19 19:57:14.308: INFO/InputManager-Callbacks(70): No virtual keys found for device qwerty2.
10-19 19:57:15.248: INFO/ARMAssembler(70): generated scanline__00000077:03515104_00001004_00000000 [ 65 ipp] (85 ins) at [0x445fd520:0x445fd674] in 1499783 ns
10-19 19:57:15.377: INFO/ARMAssembler(70): generated scanline__00000177:03515104_00001001_00000000 [ 91 ipp] (114 ins) at [0x445fd678:0x445fd840] in 813025 ns
10-19 19:57:25.087: DEBUG/dalvikvm(378): GC_EXTERNAL_ALLOC freed 89K, 54% free 3145K/6727K, external 2046K/2137K, paused 138ms
10-19 19:57:43.808: WARN/KeyCharacterMap(378): No keyboard for id 0
10-19 19:57:43.887: WARN/KeyCharacterMap(378): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
You need to generate MapView API key from your debug.keystore file.
read here how to do this http://code.google.com/android/add-ons/google-apis/mapkey.html
I'm testing a simple Android app that uses a Service, Thread, and Messenger. I noticed when I quickly start and stop the Service I sometimes get a NullPointerException and FORCE CLOSE. I debugged it and found out my Messenger instance is sometimes null and thus my handler does not get called. What am I doing wrong? Do I need to wait before restarting the Service?
OK it just now happened without the quick stop/start of the Service. So I am not sure how to reproduce this problem. It may occur randomly.
I can catch the exception and get rid of the FORCE CLOSE, but that does not solve my problem of my handler not getting called when the Messenger instance is null. I looked at the Services documentation section on Managing the Lifecycle of a Service, and I did not see any mention of having to wait before restarting a Service.
This is how I start my Service:
Intent backgroundService = new Intent(PlayAudio.this, com.marie.mp3player.BackgroundService.class);
backgroundService.putExtra(BackgroundService.EXTRA_MESSENGER, new Messenger(handler));
backgroundService.putExtra(BackgroundService.EXTRA_SONG, song);
startService(backgroundService);
This is how I stop my Service:
Intent backgroundService = new Intent(MP3Player.this, BackgroundService.class);
stopService(backgroundService);
And here is a logcat containing two NullPointerExceptions near the bottom:
D/AndroidRuntime(17736):
D/AndroidRuntime(17736): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
D/AndroidRuntime(17736): CheckJNI is OFF
D/dalvikvm(17736): creating instr width table
D/AndroidRuntime(17736): Calling main entry com.android.commands.pm.Pm
I/ActivityManager( 96): Start proc com.android.defcontainer for service com.android.defcontainer/.DefaultContainerService: pid=17744 uid=10011 gids={1015, 2001}
D/dalvikvm(17744): GC_EXPLICIT freed 46K, 50% free 2720K/5379K, external 1625K/2137K, paused 34ms
W/ActivityManager( 96): No content provider found for:
D/PackageParser( 96): Scanning package: /data/app/vmdl-1782488429.tmp
W/ActivityManager( 96): No content provider found for:
I/PackageManager( 96): Removing non-system package:com.marie.mp3player
I/ActivityManager( 96): Force stopping package com.marie.mp3player uid=10091
D/PackageManager( 96): Scanning package com.marie.mp3player
I/PackageManager( 96): Package com.marie.mp3player codePath changed from /data/app/com.marie.mp3player-2.apk to /data/app/com.marie.mp3player-1.apk; Retaining data and using new
I/PackageManager( 96): Unpacking native libraries for /data/app/com.marie.mp3player-1.apk
D/installd( 70): DexInv: --- BEGIN '/data/app/com.marie.mp3player-1.apk' ---
D/dalvikvm(17752): creating instr width table
D/dalvikvm(17752): DexOpt: load 5ms, verify+opt 18ms
D/installd( 70): DexInv: --- END '/data/app/com.marie.mp3player-1.apk' (success) ---
D/PackageManager( 96): Services: com.marie.mp3player.BackgroundService
D/PackageManager( 96): Activities: com.marie.mp3player.MP3Player com.marie.mp3player.PlayAudio
I/ActivityManager( 96): Force stopping package com.marie.mp3player uid=10091
W/PackageManager( 96): Code path for pkg : com.marie.mp3player changing from /data/app/com.marie.mp3player-2.apk to /data/app/com.marie.mp3player-1.apk
W/PackageManager( 96): Resource path for pkg : com.marie.mp3player changing from /data/app/com.marie.mp3player-2.apk to /data/app/com.marie.mp3player-1.apk
I/installd( 70): move /data/dalvik-cache/data#app#com.marie.mp3player-1.apk#classes.dex -> /data/dalvik-cache/data#app#com.marie.mp3player-1.apk#classes.dex
D/PackageManager( 96): New package installed in /data/app/com.marie.mp3player-1.apk
I/ActivityManager( 96): Force stopping package com.marie.mp3player uid=10091
D/dalvikvm( 96): GC_EXPLICIT freed 842K, 41% free 6421K/10759K, external 2424K/3027K, paused 106ms
D/dalvikvm( 192): GC_EXPLICIT freed 16K, 45% free 4617K/8327K, external 15977K/17649K, paused 67ms
D/dalvikvm( 158): GC_EXPLICIT freed 525K, 54% free 3151K/6791K, external 2480K/3071K, paused 49ms
I/ActivityManager( 96): Start proc com.appspot.swisscodemonkeys.apps for broadcast com.appspot.swisscodemonkeys.apps/.PackageReceiver: pid=17753 uid=10084 gids={3003}
I/ActivityThread(17753): Pub appbrain.SuggestionProvider: com.appspot.swisscodemonkeys.apps.search.SearchSuggestionSampleProvider
D/dalvikvm(11468): GC_EXPLICIT freed 2K, 49% free 2965K/5767K, external 1625K/2137K, paused 314ms
I/ActivityManager( 96): Start proc com.noshufou.android.su for broadcast com.noshufou.android.su/.UninstallReceiver: pid=17761 uid=10056 gids={1015, 3003}
D/dalvikvm( 96): GC_EXPLICIT freed 273K, 41% free 6367K/10759K, external 2424K/3027K, paused 101ms
I/installd( 70): unlink /data/dalvik-cache/data#app#com.marie.mp3player-2.apk#classes.dex
D/AndroidRuntime(17736): Shutting down VM
D/dalvikvm(17736): GC_CONCURRENT freed 101K, 72% free 296K/1024K, external 0K/0K, paused 0ms+1ms
D/jdwp (17736): Got wake-up signal, bailing out of select
D/dalvikvm(17736): Debugger has detached; object registry had 1 entries
I/ActivityManager( 96): Start proc com.android.voicedialer for broadcast com.android.voicedialer/.VoiceDialerReceiver: pid=17770 uid=10048 gids={3002}
D/VoiceDialerReceiver(17770): onReceive Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.marie.mp3player flg=0x10000000 cmp=com.android.voicedialer/.VoiceDialerReceiver (has extras) }
V/RecognizerEngine(17770): deleteCachedGrammarFiles /data/data/com.android.voicedialer/files/openentries.txt
I/ActivityManager( 96): Start proc com.android.vending for broadcast com.android.vending/.PackageMonitorReceiver: pid=17779 uid=10046 gids={1015, 3003}
D/dalvikvm( 67): GC_EXPLICIT freed 11K, 50% free 2717K/5379K, external 1625K/2137K, paused 94ms
D/dalvikvm( 67): GC_EXPLICIT freed <1K, 50% free 2717K/5379K, external 1625K/2137K, paused 81ms
I/ActivityThread(17779): Pub com.android.vending.SuggestionsProvider: com.android.vending.SuggestionsProvider
D/vending (17779): [1] VendingApplication.onCreate(): Resetting ServiceLocator from app
D/dalvikvm( 67): GC_EXPLICIT freed <1K, 50% free 2717K/5379K, external 1625K/2137K, paused 93ms
D/InstallReceiver(17761): com.marie.mp3player
I/ActivityManager( 96): Start proc com.google.android.partnersetup for broadcast com.google.android.partnersetup/.AppInstalledReceiver: pid=17791 uid=10021 gids={}
D/AndroidRuntime(17783):
D/AndroidRuntime(17783): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
D/AndroidRuntime(17783): CheckJNI is OFF
D/dalvikvm(17783): creating instr width table
D/GTalkService( 211): handlePackageInstalled: re-initialize providers
D/GTalkService( 211): [RawStanzaProvidersMgr] ##### searchProvidersFromIntent
D/GTalkService( 211): [RawStanzaProvidersMgr] no intent receivers found
D/VoiceDialerReceiver(17770): onReceive Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.marie.mp3player flg=0x10000000 cmp=com.android.voicedialer/.VoiceDialerReceiver (has extras) }
V/RecognizerEngine(17770): deleteCachedGrammarFiles /data/data/com.android.voicedialer/files/openentries.txt
I/ActivityManager( 96): Start proc com.google.android.googlequicksearchbox for broadcast com.google.android.googlequicksearchbox/.CorporaUpdateReceiver: pid=17798 uid=10022 gids={3003}
I/ActivityThread(17798): Pub com.google.android.googlequicksearchbox.shortcuts: com.google.android.googlequicksearchbox.ShortcutsProvider
I/ActivityThread(17798): Pub com.google.android.googlequicksearchbox.google: com.google.android.googlequicksearchbox.google.GoogleSuggestionProvider
I/ActivityManager( 96): Start proc com.google.android.apps.maps:FriendService for broadcast com.google.android.apps.maps/com.google.googlenav.friend.android.ServiceReceiver: pid=17812 uid=10033 gids={3003, 1015}
D/AndroidRuntime(17783): Calling main entry com.android.commands.am.Am
I/ActivityManager( 96): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.marie.mp3player/.MP3Player } from pid 17783
D/AndroidRuntime(17783): Shutting down VM
D/dalvikvm(17783): GC_CONCURRENT freed 102K, 69% free 320K/1024K, external 0K/0K, paused 0ms+0ms
D/jdwp (17783): Got wake-up signal, bailing out of select
D/dalvikvm(17783): Debugger has detached; object registry had 1 entries
I/ActivityManager( 96): Start proc com.marie.mp3player for activity com.marie.mp3player/.MP3Player: pid=17822 uid=10091 gids={}
I/AndroidRuntime(17783): NOTE: attach of thread 'Binder Thread #3' failed
I/ActivityManager( 96): Start proc com.google.android.apps.maps:NetworkLocationService for service com.google.android.apps.maps/com.google.android.location.internal.server.NetworkLocationService: pid=17830 uid=10033 gids={3003, 1015}
I/ActivityManager( 96): Displayed com.marie.mp3player/.MP3Player: +429ms
I/ActivityManager( 96): Start proc com.noinnion.android.greader.readerpro for broadcast com.noinnion.android.greader.readerpro/.OnUpgradeReceiver: pid=17831 uid=10070 gids={3003, 1015}
V/RenderScript_jni( 192): surfaceDestroyed
I/ActivityThread(17831): Pub com.noinnion.android.greader.readerpro: com.noinnion.android.greader.readerpro.ReaderProvider
D/InternalNlpService(17830): onCreate
D/NetworkLocationServiceThread(17830): start monitoring enabled
D/NetworkLocationServiceThread(17830): updateState
D/NetworkLocationServiceThread(17830): Creating RealOs
D/vending (17779): [11] LocalAssetCache.updateOnePackage(): No local info for com.marie.mp3player
D/szipinf (17830): Initializing inflate state
D/szipinf (17830): Initializing zlib to inflate
D/vending (17779): [12] LocalAssetCache.updateOnePackage(): No local info for com.marie.mp3player
D/dalvikvm(17830): GC_CONCURRENT freed 460K, 43% free 3851K/6727K, external 1625K/2137K, paused 2ms+3ms
D/WifiLocator(17830): Too many cache misses. Need server request. hasLocation=0 noLocation=1 cacheMiss=2
I/System.out(17830): [INFO:1747]: f: Running flush
I/System.out(17830): [INFO:1761]: f: Sending payload [bytes=300]
I/System.out(17830): [INFO:6772]: f: Running flush
I/System.out(17830): [INFO:6761]: f: Running delayed flush
I/ActivityManager( 96): Start proc org.my_pod.mypod for service org.my_pod.mypod/net.robmunro.mypod.UpdateFeedsService: pid=17853 uid=10080 gids={3003, 1015}
I/ActivityThread(17853): Pub org.my_pod.mypod: net.robmunro.mypod.util.MyPodContentProvider
I/ActivityManager( 96): Starting: Intent { cmp=com.marie.mp3player/.PlayAudio (has extras) } from pid 17822
I/handleMessge(17822): songNum: 10
I/ActivityManager( 96): Displayed com.marie.mp3player/.PlayAudio: +297ms
W/KeyCharacterMap(17822): No keyboard for id 131074
W/KeyCharacterMap(17822): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
D/MP3Player(17822): Stop the background Service
D/WifiLocator(17830): Too many cache misses. Need server request. hasLocation=0 noLocation=1 cacheMiss=2
E/GlsClient-query(17830): requestFailed
E/GlsClient-query(17830): ay.g
E/GlsClient-query(17830): at ay.d.t(Unknown Source)
E/GlsClient-query(17830): at ay.b.a(Unknown Source)
E/GlsClient-query(17830): at Z.b.g(Unknown Source)
E/GlsClient-query(17830): at Z.a.g(Unknown Source)
E/GlsClient-query(17830): at Z.d.run(Unknown Source)
E/GlsClient-query(17830): at aE.d.run(Unknown Source)
D/dalvikvm(13124): GC_EXPLICIT freed 2K, 50% free 2715K/5379K, external 1625K/2137K, paused 56ms
D/dalvikvm( 192): GC_EXPLICIT freed 88K, 44% free 4690K/8327K, external 16026K/17649K, paused 85ms
D/MP3Player(17822): Stop the background Service
I/ActivityManager( 96): Starting: Intent { cmp=com.marie.mp3player/.PlayAudio (has extras) } from pid 17822
I/handleMessge(17822): songNum: 10
I/ActivityManager( 96): Displayed com.marie.mp3player/.PlayAudio: +305ms
D/MP3Player(17822): Stop the background Service
D/dalvikvm(17830): GC_CONCURRENT freed 1201K, 51% free 3612K/7239K, external 1625K/2137K, paused 3ms+3ms
I/ActivityManager( 96): Starting: Intent { cmp=com.marie.mp3player/.PlayAudio (has extras) } from pid 17822
I/handleMessge(17822): songNum: 10
I/System.out(17830): [INFO:50519]: f: Response [http=200,length=147]
I/ActivityManager( 96): Displayed com.marie.mp3player/.PlayAudio: +307ms
I/ActivityManager( 96): Starting: Intent { cmp=com.marie.mp3player/.PlayAudio (has extras) } from pid 17822
I/ActivityManager( 96): Displayed com.marie.mp3player/.PlayAudio: +255ms
D/MP3Player(17822): Stop the background Service
I/ActivityManager( 96): Starting: Intent { cmp=com.marie.mp3player/.PlayAudio (has extras) } from pid 17822
I/handleMessge(17822): songNum: 10
I/ActivityManager( 96): Displayed com.marie.mp3player/.PlayAudio: +302ms
D/MP3Player(17822): Stop the background Service
I/ActivityManager( 96): Starting: Intent { cmp=com.marie.mp3player/.PlayAudio (has extras) } from pid 17822
I/handleMessge(17822): songNum: 10
I/ActivityManager( 96): Displayed com.marie.mp3player/.PlayAudio: +296ms
D/MP3Player(17822): Stop the background Service
I/ActivityManager( 96): Starting: Intent { cmp=com.marie.mp3player/.PlayAudio (has extras) } from pid 17822
I/handleMessge(17822): songNum: 10
I/ActivityManager( 96): Displayed com.marie.mp3player/.PlayAudio: +294ms
D/MP3Player(17822): Stop the background Service
I/ActivityManager( 96): Starting: Intent { cmp=com.marie.mp3player/.PlayAudio (has extras) } from pid 17822
E/(Messenger)messenger: (17822): NullPointerException
W/System.err(17822): java.lang.NullPointerException
W/System.err(17822): at com.marie.mp3player.BackgroundService$ServiceWorker.run(BackgroundService.java:65)
W/System.err(17822): at java.lang.Thread.run(Thread.java:1019)
I/ActivityManager( 96): Displayed com.marie.mp3player/.PlayAudio: +278ms
D/MP3Player(17822): Stop the background Service
I/ActivityManager( 96): Starting: Intent { cmp=com.marie.mp3player/.PlayAudio (has extras) } from pid 17822
E/(Messenger)messenger: (17822): NullPointerException
W/System.err(17822): java.lang.NullPointerException
W/System.err(17822): at com.marie.mp3player.BackgroundService$ServiceWorker.run(BackgroundService.java:65)
W/System.err(17822): at java.lang.Thread.run(Thread.java:1019)
I/ActivityManager( 96): Displayed com.marie.mp3player/.PlayAudio: +282ms
D/MP3Player(17822): Stop the background Service
I/ActivityManager( 96): Starting: Intent { cmp=com.marie.mp3player/.PlayAudio (has extras) } from pid 17822
I/handleMessge(17822): songNum: 10
I/ActivityManager( 96): Displayed com.marie.mp3player/.PlayAudio: +307ms
D/MP3Player(17822): Stop the background Service
I/ActivityManager( 96): Starting: Intent { cmp=com.marie.mp3player/.PlayAudio (has extras) } from pid 17822
I/handleMessge(17822): songNum: 10
I/ActivityManager( 96): Displayed com.marie.mp3player/.PlayAudio: +284ms
D/MP3Player(17822): Stop the background Service
I/ActivityManager( 96): Starting: Intent { cmp=com.marie.mp3player/.PlayAudio (has extras) } from pid 17822
I/handleMessge(17822): songNum: 10
I/ActivityManager( 96): Displayed com.marie.mp3player/.PlayAudio: +291ms
It was suggested that I add the code where the NullPointerException occurs. Very important. In fact here's the whole thread where the exception occurs marked with an arrow and stars:
/*
* This is the ServiceWorker thread that calls messenger to pass messages
* and data to the PlayAudio activity.
*/
class ServiceWorker implements Runnable
{
public void run() {
// do background processing here... a simple message for now
// send a message to the handler defined in the PlayAudio
try {
Message msg1 = Message.obtain();
msg1.obj = "Song";
msg1.arg1 = song;
if (messenger == null) Log.e("(Messenger)messenger: ", "NullPointerException");
messenger.send(msg1); // <== *** EXCEPTION OCCURS HERE ***
} catch (RemoteException e) {
e.printStackTrace();
} catch (NullPointerException e) {
e.printStackTrace();
}
// stop the service when done...
// BackgroundService.this.stopSelf();
// Or use the unbindBtn in the MP3Player activity.
}
}
If anyone sees a mistake here that would sometimes cause my Message instance to be null I sure would appreciate an answer.
Marie, assuming that the rest of your service is as in your other question. Here is what happens and causes your NPE.
In onCreate you create and start your thread, but you extract messenger in onStart method. If your worker method executes before onStart, you get NPE. The order of them is random, so sometimes you get NPE and sometimes not.