I just start working on a project which I have to upgrade and upload an update in Android Market. For now I'm just testing the application to see and find any bugs so I can fix them (the app is not written by me). So while I was testing, the application crashed and I got really strange exception (for me), which I've never seen before.
Here it is:
02-28 18:29:27.008: E/ActivityManager(96): ANR in com.nimasystems.android.radio
02-28 18:29:27.008: E/ActivityManager(96): Reason: Executing service
com.nimasystems.android.radio/com.nimasystems.android.player.service.DRadioPlayerService
02-28 18:29:27.008: E/ActivityManager(96): Load: 1.78 / 1.52 / 2.5
02-28 18:29:27.008: E/ActivityManager(96): CPU usage from 6617ms to 37ms ago:
02-28 18:29:27.008: E/ActivityManager(96): s.android.radio: 67% = 62% user + 5% kernel / faults: 13040 minor
02-28 18:29:27.008: E/ActivityManager(96): system_server: 16% = 8% user + 8% kernel / faults: 361 minor
02-28 18:29:27.008: E/ActivityManager(96): akmd: 0% = 0% user + 0% kernel
02-28 18:29:27.008: E/ActivityManager(96): synaptics_wq: 0% = 0% user + 0% kernel
02-28 18:29:27.008: E/ActivityManager(96): adbd: 0% = 0% user + 0% kernel
02-28 18:29:27.008: E/ActivityManager(96): wpa_supplicant: 0% = 0% user + 0% kernel
02-28 18:29:27.008: E/ActivityManager(96): TOTAL: 85% = 70% user + 14% kernel
Any suggestions what can cause this kind of exception?
Thanks in advance!
ANR or application not responding usually happens when something in your code is preventing the UI thred to do its jobs. Any long term jobs or jobs that potentially can block the UI thread have to be execute in an async way. If you want help to debug you have to share a some code
the service com.nimasystems.android.player.service.DRadioPlayerService some method maybe used most time, the service run in the ui thread, so if you want avoid this, try create a new thread to run your wasted time method.
Related
Recently, I've got raspberry pi 3 and I'm trying to run android things doorbell project. I build it in Android studio 3.0 and i did everything that explained in android things doorbell project. but when i build the app to raspberry pi, it doesn't work. When I try debugging, it terminates after few time passes(i didn't touch everything).
This is the system process debugging log. what do i have to do?
08-16 08:03:13.434 412-426/system_process W/ActivityManager: Launch timeout has expired, giving up wake lock!
08-16 08:03:28.361 412-426/system_process W/ActivityManager: Timeout executing service: ServiceRecord{c4f101b u0 com.example.androidthings.doorbell/com.google.android.gms.measurement.AppMeasurementService}
--------- beginning of main
08-16 08:03:28.397 412-426/system_process I/Process: Sending signal. PID: 6135 SIG: 3
08-16 08:03:28.407 412-426/system_process I/Process: Sending signal. PID: 412 SIG: 3
08-16 08:03:28.407 412-417/system_process I/art: Thread[2,tid=417,WaitingInMainSignalCatcherLoop,Thread*=0xa9b0d000,peer=0x12c010d0,"Signal Catcher"]: reacting to signal 3
08-16 08:03:29.011 412-417/system_process I/art: Wrote stack traces to '/data/anr/traces.txt'
08-16 08:03:29.011 412-426/system_process I/Process: Sending signal. PID: 537 SIG: 3
08-16 08:03:29.903 412-426/system_process W/ProcessCpuTracker: Skipping unknown process pid 6351
08-16 08:03:30.473 412-426/system_process E/ActivityManager: ANR in com.example.androidthings.doorbell
PID: 6135
Reason: executing service com.example.androidthings.doorbell/com.google.android.gms.measurement.AppMeasurementService
Load: 0.63 / 0.31 / 0.32
CPU usage from 557691ms to 0ms ago (2017-08-16 07:54:10.671 to 2017-08-16 08:03:28.362):
3.4% 412/system_server: 2.5% user + 0.9% kernel / faults: 2730 minor
2.4% 152/adbd: 0.2% user + 2.1% kernel / faults: 44173 minor
1.1% 1213/perfd: 0.6% user + 0.4% kernel / faults: 186 minor
0.5% 6014/kworker/u8:1: 0% user + 0.5% kernel
0.5% 101/irq/92-mmc1: 0% user + 0.5% kernel
0.4% 6035/kworker/u8:2: 0% user + 0.4% kernel
0.3% 6024/kworker/u8:0: 0% user + 0.3% kernel
0.3% 652/com.google.android.gms.persistent: 0.3% user + 0% kernel / faults: 1669 minor
0.3% 150/surfaceflinger: 0.2% user + 0% kernel / faults: 1514 minor
0% 107/brcmf_wdog/mmc1: 0% user + 0% kernel
0% 520/wpa_supplicant: 0% user + 0% kernel
0% 7/rcu_preempt: 0% user + 0% kernel
0% 840/com.google.android.gms: 0% user + 0% kernel / faults: 88 minor
0% 3/ksoftirqd/0: 0% user + 0% kernel
0% 20/ksoftirqd/3: 0% user + 0% kernel
0% 8/rcu_sched: 0% user + 0% kernel
0% 127/logd: 0% user + 0% kernel / faults: 14 minor
0% 169/metrics_collector: 0% user + 0% kernel / faults: 19 minor
0% 620/com.android.iotlauncher: 0% user + 0% kernel / faults: 20 minor
0% 104/mmcqd/0: 0% user + 0% kernel
0% 149/servicemanager: 0% user + 0% kernel
0% 170/metricsd: 0% user + 0% kernel
0% 756/com.google.process.gapps: 0% user + 0% kernel / faults: 19 minor
0% 16/ksoftirqd/2: 0% user + 0% kernel
0% 148/lmkd: 0% user + 0% kernel
0% 5353/kworker/0:0: 0% user + 0% kernel
0% 12/ksoftirqd/1: 0% user + 0% kernel
0% 66/kworker/2:1: 0% user + 0% kernel
0% 121/jbd2/mmcblk0p15: 0% user + 0% kernel
0% 153/zygote: 0% user + 0% kernel / faults: 141 minor
0% 10/migration/0: 0% user + 0% kernel
0% 19/migration/3: 0% user + 0% kernel
0% 163/netd: 0% user + 0% kernel / faults: 40 minor
0% 166/sh: 0% user + 0% kernel / faults: 102 minor
0% 172/update_engine: 0% user + 0% kernel
0% 5981/kworker/1:2: 0% user + 0% kernel
+0% 6046/kworker/2:0: 0% user + 0% kernel
+0% 6048/kworker/3:1: 0% user + 0% kernel
+0% 6135/com.example.androidthings.doorbell: 0% user + 0% kernel
+0% 6219/logcat: 0% user + 0% kernel
+0% 6337/dumpsys: 0% user + 0% kernel
3.2% TOTAL: 1.6% user + 1.3% kernel + 0% iowait + 0.2% softirq
CPU usage from 1542ms to 2074ms later (2017-08-16 08:03:29.904 to 2017-08-16 08:03:30.436):
67% 412/system_server: 46% user + 20% kernel / faults: 3 minor
31% 680/Binder:412_5: 26% user + 5.6% kernel
28% 628/Binder:412_4: 18% user + 9.3% kernel
5.6% 426/ActivityManager: 0% user + 5.6% kernel
1.8% 716/Binder:412_6: 0% user + 1.8% kernel
5.1% 1213/perfd: 3.4% user + 1.7% kernel / faults: 6 minor
1.7% 1223/perfd: 1.7% user + 0% kernel
1.7% 1224/perfd: 1.7% user + 0% kernel
1.7% 6149/Studio:PollMem: 0% user + 1.7% kernel
3.7% 152/adbd: 1.8% user + 1.8% kernel / faults: 59 minor
1.8% 152/adbd: 0% user + 1.8% kernel
1.8% 1146/->host: 1.8% user + 0% kernel
1.8% 1147/<-host: 0% user + 1.8% kernel
1.7% 6014/kworker/u8:1: 0% user + 1.7% kernel
+0% 6358/dumpsys: 0% user + 0% kernel
26% TOTAL: 17% user + 9.1% kernel
08-16 08:03:30.476 412-427/system_process W/ActivityManager: Force finishing activity com.example.androidthings.doorbell/.DoorbellActivity
08-16 08:03:30.483 412-427/system_process I/ActivityManager: Killing 6135:com.example.androidthings.doorbell/u0a28 (adj 0): user request after error
08-16 08:03:30.564 412-5697/system_process D/ActivityManager: cleanUpApplicationRecord -- 6135
08-16 08:03:30.569 412-433/system_process I/WindowManager: Destroying surface Surface(name=Starting com.example.androidthings.doorbell) called by com.android.server.wm.WindowStateAnimator.destroySurface:2014 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:881 com.android.server.wm.WindowState.removeLocked:1449 com.android.server.wm.WindowManagerService.removeWindowInnerLocked:2478 com.android.server.wm.WindowManagerService.removeWindowLocked:2436 com.android.server.wm.WindowManagerService.removeWindowLocked:2305 com.android.server.wm.WindowManagerService.removeWindow:2300 com.android.server.wm.Session.remove:193
08-16 08:03:30.614 412-424/system_process W/InputMethodManagerService: Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#79a2cdf attribute=null, token = android.os.BinderProxy#161884c
08-16 08:03:32.129 412-422/system_process I/art: Background partial concurrent mark sweep GC freed 26801(2MB) AllocSpace objects, 14(880KB) LOS objects, 33% free, 6MB/10MB, paused 2.427ms total 120.639ms
08-16 08:03:32.913 412-501/system_process I/ActivityManager: Force stopping com.example.androidthings.doorbell appid=10028 user=0: from pid 6365
08-16 08:03:34.067 412-479/system_process E/TaskPersister: File error accessing recents directory (directory doesn't exist?).
I have made game in cocos2dx for ios device. Now I want to port it for android but, the code which works fine for ios is crashing for android. The eclipse shows 3 types of logCat outputs which are as follows.
///////////////////////////////////////////////////////////////////////////////////////////////////////
1) 11-27 10:41:05.168: W/SharedBufferStack(4417): waitForCondition(LockCondition) timed out (identity=302, status=0). CPU may be pegged. trying again.
///////////////////////////////////////////////////////////////////////////////////////////////////////
2) 11-27 10:41:36.448: D/lights(248): set_light_backlight: brightness=255
11-27 10:41:41.518: I/InputDispatcher(248): Application is not responding: Window{2b452080 org.cocos2dx.Saburbia_android/org.cocos2dx.Saburbia_android.Saburbia_android paused=false}. 5000.4ms since event, 5000.4ms since wait started
11-27 10:41:41.518: I/WindowManager(248): Input event dispatching timed out sending to org.cocos2dx.Saburbia_android/org.cocos2dx.Saburbia_android.Saburbia_android
11-27 10:41:41.528: I/Process(248): Sending signal. PID: 4417 SIG: 3
11-27 10:41:41.528: I/dalvikvm(4417): threadid=4: reacting to signal 3
11-27 10:41:41.728: I/Process(248): Sending signal. PID: 248 SIG: 3
11-27 10:41:41.728: I/dalvikvm(248): threadid=4: reacting to signal 3
11-27 10:41:41.748: I/dalvikvm(248): Wrote stack traces to '/data/anr/traces.txt'
11-27 10:41:41.748: I/Process(248): Sending signal. PID: 355 SIG: 3
11-27 10:41:41.748: I/dalvikvm(355): threadid=4: reacting to signal 3
11-27 10:41:41.758: I/dalvikvm(355): Wrote stack traces to '/data/anr/traces.txt'
11-27 10:41:41.758: I/Process(248): Sending signal. PID: 320 SIG: 3
11-27 10:41:41.758: I/dalvikvm(320): threadid=4: reacting to signal 3
11-27 10:41:41.758: I/dalvikvm(320): Wrote stack traces to '/data/anr/traces.txt'
11-27 10:41:41.968: D/dalvikvm(248): GC_EXPLICIT freed 952K, 49% free 6943K/13447K, external 3286K/4888K, paused 78ms
11-27 10:41:42.518: E/ActivityManager(248): ANR in org.cocos2dx.Saburbia_android (org.cocos2dx.Saburbia_android/.Saburbia_android)
11-27 10:41:42.518: E/ActivityManager(248): Reason: keyDispatchingTimedOut
11-27 10:41:42.518: E/ActivityManager(248): Load: 7.93 / 7.92 / 7.79
11-27 10:41:42.518: E/ActivityManager(248): CPU usage from 27270ms to 0ms ago:
11-27 10:41:42.518: E/ActivityManager(248): 99% 4417/org.cocos2dx.Saburbia_android: 99% user + 0% kernel / faults: 2 minor
11-27 10:41:42.518: E/ActivityManager(248): 0% 3877/com.google.android.apps.maps: 0% user + 0% kernel / faults: 418 minor
11-27 10:41:42.518: E/ActivityManager(248): 0% 3957/com.svox.pico: 0% user + 0% kernel / faults: 678 minor
11-27 10:41:42.518: E/ActivityManager(248): 0% 248/system_server: 0% user + 0% kernel / faults: 8 minor
11-27 10:41:42.518: E/ActivityManager(248): 0% 1679/com.sonyericsson.customization: 0% user + 0% kernel / faults: 283 minor
11-27 10:41:42.518: E/ActivityManager(248): 0% 3647/com.sonyericsson.devicemonitor: 0% user + 0% kernel / faults: 179 minor
11-27 10:41:42.518: E/ActivityManager(248): 0% 121/rild: 0% user + 0% kernel / faults: 1 minor
11-27 10:41:42.518: E/ActivityManager(248): 0% 320/com.android.systemui: 0% user + 0% kernel / faults: 3 minor
11-27 10:41:42.518: E/ActivityManager(248): 0% 3731/com.sonyericsson.android.datamonitor: 0% user + 0% kernel / faults: 25 minor
11-27 10:41:42.518: E/ActivityManager(248): 100% TOTAL: 100% user + 0% kernel
11-27 10:41:42.518: E/ActivityManager(248): CPU usage from 461ms to 976ms later:
11-27 10:41:42.518: E/ActivityManager(248): 98% 4417/org.cocos2dx.Saburbia_android: 98% user + 0% kernel
11-27 10:41:42.518: E/ActivityManager(248): 96% 4418/HeapWorker: 96% user + 0% kernel
11-27 10:41:42.518: E/ActivityManager(248): 3.8% 248/system_server: 1.9% user + 1.9% kernel
11-27 10:41:42.518: E/ActivityManager(248): 1.9% 291/InputDispatcher: 0% user + 1.9% kernel
11-27 10:41:42.518: E/ActivityManager(248): 1.9% 442/er$SensorThread: 1.9% user + 0% kernel
11-27 10:41:42.518: E/ActivityManager(248): 100% TOTAL: 98% user + 1.9% kernel
11-27 10:41:42.518: I/InputDispatcher(248): Dropping event because the pointer is not down.
////////////////////////////////////////////////////////////////////////////////////////////////
3) and third reason is unknows as it shows meny memory address in logCat.
////////////////////////////////////////////////////////////////////////////////////////////////
I am using libcurl for web calls and pThread for threading. This game also have Facebook Integration which is done using Facebook API for mobile (Hackbook).
After facebook login, the native code connects to the server using libcurl and makes about 30 http calls using pThread so that rendering thread should not be paused for getting the response from server. Still while this loading is going on the logcat shows any of these 3 logs and restarts loading from the start. There are http request present in game also which are executed using pThreads but in game also it shows any of this 3 log and crashes randomely.
The same code works fine for the ios build. I am not able to find why its not running properly for Android. Please suggest if any rules have to be followed for android porting.
I am using versions as follows.
Android NDK : r8b
Cocos2dx : 2.0.3
Eclipse : 3.6.2
Android version : 2.2
System : Ubuntu 10.0.4
Devices : SonyEricsson NeoV (android2.3.4), Samsung Galaxy SII (android4.0.3).
Thanks in advance..
Try to find memory issue in iPhone,because auto-release code might not working correctly.
Also use the NDK stack for more detail error.
Update:Another way to track ndk stack on remote use the https://www.crittercism.com
Thank you.
I have noticed in my adobe air app that I get intermitent crashes while trying to close my Netconnection. The app stops responding and eventually if you keep trying to do something it crashes. It is happening around 7 out of 10 times which is weird!
Has anyone encountered this or knows whats going on?
Here is a link to the full ANR Trace: http://pastebin.com/ut0eZRrU
Thanks, any help would be appreciated. This bug is preventing me from releasing my app!
I have seen a few discussions where people are saying they are experiencing similar issues however, they also say that it has been sorted in air 3.3. I havent seen any improvement....
Here is a summary of what im getting in logcat:
D/dalvikvm( 2019): GC_CONCURRENT freed 1943K, 21% free 24500K/30855K, paused 2ms+21ms
D/dalvikvm( 2019): GC_EXPLICIT freed 769K, 20% free 24737K/30855K, paused 2ms+20ms
E/ActivityManager( 2019): ANR in air.com.test.mobile.rbttest.debug (air.com.test.mobile.rbttest.debug/.AppEntry)
E/ActivityManager( 2019): Reason: keyDispatchingTimedOut
E/ActivityManager( 2019): Load: 0.59 / 0.72 / 0.59
E/ActivityManager( 2019): CPU usage from 18567ms to 3234ms ago:
E/ActivityManager( 2019): 80% 9424/air.com.test.mobile.rbttest.debug: 71% user + 8.7% kernel / faults: 1406 minor
**could it be something to do with the line above? Is this line saying that my cpu has spiked up to 80%? Its weird if it is, because it works fine if I dont close the net connection!!**
E/ActivityManager( 2019): 2% 2019/system_server: 1.1% user + 0.8% kernel / faults: 39 minor
E/ActivityManager( 2019): 1.8% 2120/com.android.systemui: 1.5% user + 0.2% kernel / faults: 5 minor
E/ActivityManager( 2019): 1.5% 1885/mediaserver: 1.2% user + 0.3% kernel / faults: 4 minor
E/ActivityManager( 2019): 0.7% 1882/surfaceflinger: 0.3% user + 0.3% kernel
E/ActivityManager( 2019): 0.3% 9564/kworker/0:2: 0% user + 0.3% kernel
E/ActivityManager( 2019): 0.2% 2206/dhd_dpc: 0% user + 0.2% kernel
E/ActivityManager( 2019): 0.1% 1890/adbd: 0% user + 0.1% kernel
E/ActivityManager( 2019): 0.1% 8196/com.eolwral.osmonitor: 0% user + 0.1% kernel / faults: 20 minor
E/ActivityManager( 2019): 0.1% 8697/kworker/u:0: 0% user + 0.1% kernel
E/ActivityManager( 2019): 0.1% 965/irq/356-mxt224_: 0% user + 0.1% kernel
E/ActivityManager( 2019): 0.1% 7358/kworker/0:3: 0% user + 0.1% kernel
E/ActivityManager( 2019): 0% 3/ksoftirqd/0: 0% user + 0% kernel
E/ActivityManager( 2019): 0% 1055/mmcqd/0: 0% user + 0% kernel
E/ActivityManager( 2019): 0% 1830/jbd2/mmcblk0p10: 0% user + 0% kernel
E/ActivityManager( 2019): 0% 1881/rild: 0% user + 0% kernel
E/ActivityManager( 2019): 0% 2202/dhd_watchdog: 0% user + 0% kernel
E/ActivityManager( 2019): 0% 2781/kworker/u:23: 0% user + 0% kernel
E/ActivityManager( 2019): 0% 8708/kworker/u:1: 0% user + 0% kernel
E/ActivityManager( 2019): 0% 8756/com.android.settings: 0% user + 0% kernel / faults: 31 minor
E/ActivityManager( 2019): 0% 8860/com.google.android.gallery3d: 0% user + 0% kernel / faults: 8 minor
E/ActivityManager( 2019): 0% 27078/com.antivirus: 0% user + 0% kernel
E/ActivityManager( 2019): 49% TOTAL: 43% user + 6.4% kernel + 0.2% iowait + 0% softirq
E/ActivityManager( 2019): CPU usage from 707ms to 1226ms later:
E/ActivityManager( 2019): 10% 2019/system_server: 1.8% user + 9% kernel / faults: 3 minor
E/ActivityManager( 2019): 9% 2077/InputDispatcher: 0% user + 9% kernel
E/ActivityManager( 2019): 4.9% 2120/com.android.systemui: 3.9% user + 0.9% kernel / faults: 1 minor
E/ActivityManager( 2019): 3.9% 2120/ndroid.systemui: 3.9% user + 0% kernel
E/ActivityManager( 2019): 6.8% 9424/air.com.test.mobile.rbttest.debug: 0% user + 6.8% kernel
E/ActivityManager( 2019): 6.8% 9464/e.rbttest.debug: 1.7% user + 5.1% kernel
E/ActivityManager( 2019): 1.2% 7358/kworker/0:3: 0% user + 1.2% kernel
E/ActivityManager( 2019): 7.7% TOTAL: 1.9% user + 5.8% kernel
W/ActivityManager( 2019): Force finishing activity air.com.test.mobile.rbttest.debug/.AppEntry
I/ActivityManager( 2019): Killing ProcessRecord{416f3410 9424:air.com.test.mobile.rbttest.debug/10075}: user's request
I/ActivityManager( 2019): Process air.com.test.mobile.rbttest.debug (pid 9424) has died.
I/WindowManager( 2019): WIN DEATH: Window{420baca0 SurfaceView paused=false}
I/WindowManager( 2019): WIN DEATH: Window{41f93898 air.com.test.mobile.rbttest.debug/air.com.test.mobile.rbttest.debug.A ppEntry paused=true}
UPDATE:
I have found that if the NetConnection is either closed via the fms server of via the publisher then it causes the android app to crash!
The release of adobe air 3.4 beta seems to have fixed this issue.
I'm developping a simple widget which update by downloading a big image file.
To do so I'm just launching a service which retrieve the image. I launch it from the onUpdate method of AppWidgetProvider.
Like that :
public void onUpdate(Context context, AppWidgetManager appWidgetManager,
int[] appWidgetIds)
{
Intent intent = new Intent(context, UpdateService.class);
context.startService(intent);
}
In wifi everything is working well.
But in 3G network is slow, the downloading take too much time. As a result my service is killed by android system.
Here the trace:
03-04 15:19:02.698: INFO/ActivityManager(166): Start proc com.testpic for broadcast
com.testpic/com.testpic.TestPicActivity: pid=1994 uid=10087 gids={1015, 3003}
03-04 15:19:22.889: WARN/ActivityManager(166): Timeout executing service:
ServiceRecord{41851230 com.testpic/com.testpic.service.UpdateService}
03-04 15:19:22.944: INFO/dalvikvm(166): Jit: resizing JitTable from 8192 to 16384
03-04 15:19:22.967: INFO/Process(166): Sending signal. PID: 1994 SIG: 3
03-04 15:19:22.967: INFO/dalvikvm(1994): threadid=3: reacting to signal 3
03-04 15:19:22.994: INFO/dalvikvm(1994): Wrote stack traces to '/data/anr/traces.txt'
03-04 15:19:22.994: INFO/Process(166): Sending signal. PID: 166 SIG: 3
03-04 15:19:22.994: INFO/dalvikvm(166): threadid=3: reacting to signal 3
03-04 15:19:23.053: INFO/dalvikvm(166): Wrote stack traces to '/data/anr/traces.txt'
03-04 15:19:23.053: INFO/Process(166): Sending signal. PID: 232 SIG: 3
03-04 15:19:23.053: INFO/dalvikvm(232): threadid=3: reacting to signal 3
03-04 15:19:23.061: INFO/dalvikvm(232): Wrote stack traces to '/data/anr/traces.txt'
03-04 15:19:23.061: INFO/Process(166): Sending signal. PID: 342 SIG: 3
03-04 15:19:23.061: INFO/dalvikvm(342): threadid=3: reacting to signal 3
03-04 15:19:23.084: INFO/dalvikvm(342): Wrote stack traces to '/data/anr/traces.txt'
03-04 15:19:23.084: INFO/Process(166): Sending signal. PID: 359 SIG: 3
03-04 15:19:23.084: INFO/dalvikvm(359): threadid=3: reacting to signal 3
03-04 15:19:23.096: INFO/dalvikvm(359): Wrote stack traces to '/data/anr/traces.txt'
03-04 15:19:23.272: DEBUG/dalvikvm(166): GC_CONCURRENT freed 914K, 16% free
13371K/15879K, paused 3ms+5ms
03-04 15:19:23.467: DEBUG/dalvikvm(166): GC_EXPLICIT freed 459K, 16% free 13475K/15879K,
paused 3ms+5ms
03-04 15:19:24.065: ERROR/ActivityManager(166): ANR in com.testpic
Reason: Executing service com.testpic/com.testpic.service.UpdateService
Load: 1.58 / 1.52 / 0.84
CPU usage from 12327ms to 0ms ago with 99% awake:
16% 166/system_server: 7.3% user + 9.4% kernel / faults: 8 minor
9.1% 1994/com.testpic: 7.1% user + 2% kernel / faults: 249 minor
0.7% 374/com.android.launcher: 0.6% user + 0% kernel / faults: 15 minor
0.6% 342/com.android.phone: 0.4% user + 0.2% kernel / faults: 15 minor
0.4% 5/kworker/u:0: 0% user + 0.4% kernel
0.4% 1343/kworker/0:1: 0% user + 0.4% kernel
0.4% 66/yaffs-bg-1: 0% user + 0.4% kernel
0.4% 77/rild: 0% user + 0.3% kernel
0.2% 897/de.devmil.minimaltext: 0.2% user + 0% kernel / faults: 63 minor
0.1% 293/com.google.process.gapps: 0% user + 0% kernel / faults: 4 minor
0% 159/logcat: 0% user + 0% kernel
0% 160/flush-179:0: 0% user + 0% kernel
0% 232/com.android.systemui: 0% user + 0% kernel / faults: 1 minor
0% 835/com.google.android.apps.maps:NetworkLocationService: 0% user + 0% kernel /
faults: 15 minor
25% TOTAL: 14% user + 11% kernel + 0.2% softirq
CPU usage from 577ms to 1090ms later with 99% awake:
22% 166/system_server: 8.7% user + 14% kernel
10% 182/ActivityManager: 3.5% user + 7% kernel
7% 179/system_server: 0% user + 7% kernel
3.5% 199/er$SensorThread: 0% user + 3.5% kernel
1.7% 181/er.ServerThread: 1.7% user + 0% kernel
4.5% 1994/com.testpic: 4.5% user + 0% kernel / faults: 4 minor
4.5% 1994/com.testpic: 4.5% user + 0% kernel
19% TOTAL: 7.6% user + 11% kernel
03-04 15:19:24.065: WARN/ActivityManager(166): Killing ProcessRecord{416316c0
1994:com.testpic/10087}: background ANR
03-04 15:19:24.073: INFO/ActivityManager(166): Process com.testpic (pid 1994) has died.
03-04 15:19:24.073: WARN/ActivityManager(166): Scheduling restart of crashed service
com.testpic/com.testpic.service.UpdateService in 42380ms
So my questions are :
- How can I do to avoid this ANR ?
- Is it correct to use a service in this kind of situation ?
- If not what should I use to perform that kind of treatment ?
Thank you in advance for your help :)
A regular Service still runs on the UI thread unless you tell it to spawn another one. Consider using an IntentService instead which handles that for you.
I had an application running well, i dont know what happened now I am getting this log.. I am new to Android and it's hard for me to catch.. where it is faulting.. can you tell something by this log? thank you
04-24 04:09:29.561: WARN/ActivityManager(61): Force finishing activity com.gaming.game/.GameActivity
04-24 04:47:55.491: ERROR/ActivityManager(61): ANR in com.gaming.game (com.gaming.game/.GameActivity)
04-24 04:47:55.491: ERROR/ActivityManager(61): Reason: keyDispatchingTimedOut
04-24 04:47:55.491: ERROR/ActivityManager(61): Parent: com.gaming.game/.gaming
04-24 04:47:55.491: ERROR/ActivityManager(61): Load: 0.86 / 0.54 / 0.41
04-24 04:47:55.491: ERROR/ActivityManager(61): CPU usage from 48945ms to 2842ms ago:
04-24 04:47:55.491: ERROR/ActivityManager(61): 9.2% 61/system_server: 6.9% user + 2.2% kernel / faults: 1381 minor
04-24 04:47:55.491: ERROR/ActivityManager(61): 1.2% 672/com.android.launcher: 0.6% user + 0.6% kernel / faults: 368 minor
04-24 04:47:55.491: ERROR/ActivityManager(61): 0.6% 448/com.android.defcontainer: 0.1% user + 0.5% kernel / faults: 56 minor
04-24 04:47:55.491: ERROR/ActivityManager(61): 1% 41/adbd: 0.1% user + 0.9% kernel / faults: 64 minor
04-24 04:47:55.491: ERROR/ActivityManager(61): 0.3% 125/com.android.systemui: 0.2% user + 0% kernel / faults: 1 minor
04-24 04:47:55.491: ERROR/ActivityManager(61): 0.2% 123/com.android.phone: 0% user + 0.1% kernel / faults: 2 minor
04-24 04:47:55.491: ERROR/ActivityManager(61): 0% 587/logcat: 0% user + 0% kernel
04-24 04:47:55.491: ERROR/ActivityManager(61): 0% 35/installd: 0% user + 0% kernel / faults: 6 minor
04-24 04:47:55.491: ERROR/ActivityManager(61): 0% 120/jp.co.omronsoft.openwnn: 0% user + 0% kernel / faults: 3 minor
04-24 04:47:55.491: ERROR/ActivityManager(61): 0% 313/com.android.quicksearchbox: 0% user + 0% kernel / faults: 2 minor
04-24 04:47:55.491: ERROR/ActivityManager(61): 0% 4/events/0: 0% user + 0% kernel
04-24 04:47:55.491: ERROR/ActivityManager(61): 0% 32/rild: 0% user + 0% kernel
04-24 04:47:55.491: ERROR/ActivityManager(61): 0% 33/zygote: 0% user + 0% kernel / faults: 18 minor
04-24 04:47:55.491: ERROR/ActivityManager(61): 0% 499/com.svox.pico: 0% user + 0% kernel / faults: 18 minor
04-24 04:47:55.491: ERROR/ActivityManager(61): +0% 1565/com.gaming.game: 0% user + 0% kernel
04-24 04:47:55.491: ERROR/ActivityManager(61): 31% TOTAL: 19% user + 11% kernel + 0% irq + 0.2% softirq
04-24 04:47:55.491: ERROR/ActivityManager(61): CPU usage from 796ms to 1401ms later:
04-24 04:47:55.491: ERROR/ActivityManager(61): 43% 1565/com.gaming.game: 0% user + 43% kernel / faults: 1 minor
04-24 04:47:55.491: ERROR/ActivityManager(61): 43% 1567/HeapWorker: 0% user + 43% kernel
04-24 04:47:55.491: ERROR/ActivityManager(61): 10% 61/system_server: 6.6% user + 3.3% kernel
04-24 04:47:55.491: ERROR/ActivityManager(61): 10% 100/InputDispatcher: 6.6% user + 3.3% kernel
04-24 04:47:55.491: ERROR/ActivityManager(61): 76% TOTAL: 4.6% user + 72% kernel
ERROR/ActivityManager(61): ANR in com.gaming.game (com.gaming.game/.GameActivity)
Reason: keyDispatchingTimedOut 04-24 04:47:55.491:
Your activity is taking too long to respond as is being killed.
Take a look at this post: http://danbarnett.net/android-anr-keydispatchingtimedout-178.html
This ANR, or Application Not
Responding, error occurs when a
process on the main thread takes too
long (something like 5 seconds).
Android kills that process and any
related by design to spare the
device's resources.
The solution is to run
resource-expensive tasks on another
thread, and then post, or update the
main thread accordingly. A common use
for this is network calls (and this
was what my problem was). The
following is an example of how to
implement this logic, in my case to
check if an update is needed:
ANR means your application is not being responsive. I.e. you're doing an expensive operation (what, we cannot tell without your code) that is locking up the UI thread. Try kicking off some AsyncTasks or using a service for your long running operations.
try to add some sleep time after you set bitmap to the canvas and before you add other things on top of it. It helped me