Reputation: 1765
While using honeycomb emulator is shows following error and become very slow.
02-11 02:58:50.949: ERROR/ActivityManager(365): ANR in com.android.launcher (com.android.launcher/com.android.launcher2.Launcher)
02-11 02:58:50.949: ERROR/ActivityManager(365): Reason: keyDispatchingTimedOut
02-11 02:58:50.949: ERROR/ActivityManager(365): Load: 2.57 / 1.18 / 0.89
02-11 02:58:50.949: ERROR/ActivityManager(365): CPU usage from 3042ms to -7585ms ago:
02-11 02:58:50.949: ERROR/ActivityManager(365): 74% 365/system_server: 53% user + 21% kernel / faults: 335 minor
02-11 02:58:50.949: ERROR/ActivityManager(365): 9% 780/zygote: 3.8% user + 5.1% kernel / faults: 915 minor
02-11 02:58:50.949: ERROR/ActivityManager(365): 8.2% 684/com.android.launcher: 6% user + 2.1% kernel / faults: 51 minor
02-11 02:58:50.949: ERROR/ActivityManager(365): 0% 432/zygote: 0% user + 0% kernel / faults: 22 minor
02-11 02:58:50.949: ERROR/ActivityManager(365): 2.4% 41/adbd: 0.3% user + 2% kernel
02-11 02:58:50.949: ERROR/ActivityManager(365): 0.4% 546/com.android.systemui: 0.1% user + 0.2% kernel / faults: 11 minor
02-11 02:58:50.949: ERROR/ActivityManager(365): 0.5% 733/logcat: 0% user + 0.5% kernel
02-11 02:58:50.949: ERROR/ActivityManager(365): 0% 425/zygote: 0% user + 0% kernel
02-11 02:58:50.949: ERROR/ActivityManager(365): 0% 28/servicemanager: 0% user + 0% kernel
02-11 02:58:50.949: ERROR/ActivityManager(365): 100% TOTAL: 65% user + 34% kernel + 0.6% softirq
02-11 02:58:50.949: ERROR/ActivityManager(365): CPU usage from 9680ms to 11220ms later:
02-11 02:58:50.949: ERROR/ActivityManager(365): 70% 365/system_server: 28% user + 42% kernel
02-11 02:58:50.949: ERROR/ActivityManager(365): 49% 396/InputDispatcher: 18% user + 30% kernel
02-11 02:58:50.949: ERROR/ActivityManager(365): 21% 366/HeapWorker: 8.1% user + 13% kernel
02-11 02:58:50.949: ERROR/ActivityManager(365): 26% 78014% user + 11% kernel / faults: 323 minor
02-11 02:58:50.949: ERROR/ActivityManager(365): 20% 780/.ap: 10% user + 10% kernel
02-11 02:58:50.949: ERROR/ActivityManager(365): 5.4% 781/HeapWorker: 4.6% user + 0.7% kernel
02-11 02:58:50.949: ERROR/ActivityManager(365): 1.3% 41/adbd: 0% user + 1.3% kernel
02-11 02:58:50.949: ERROR/ActivityManager(365): 0.6% 41/adbd: 0% user + 0.6% kernel
02-11 02:58:50.949: ERROR/ActivityManager(365): 0.6% 65/adbd: 0% user + 0.6% kernel
02-11 02:58:50.949: ERROR/ActivityManager(365): 0.7% 684/com.android.launcher: 0.7% user + 0% kernel
02-11 02:58:50.949: ERROR/ActivityManager(365): 0.7% 684/ndroid.launcher: 0.7% user + 0% kernel
02-11 02:58:50.949: ERROR/ActivityManager(365): 0.7% 691/Binder Thread #: 0.7% user + 0% kernel
02-11 02:58:50.949: ERROR/ActivityManager(365): 100% TOTAL: 40% user + 58% kernel + 0.6% softirq
What did went wrong here. What i need fix this?
thank you
Upvotes: 5
Views: 1030
Reputation: 3999
Seems as if you are doing some complex computation at the time when activity is loading.
ANR(Activity Not Responding)
Generally ANR is trigger if Activity
fails to tell the android OS that "I am still alive".
android Developer.
You need to execute in Async manner.
So for an instance if you want to do some long waiting process onClick()
.
public void onClick(View v) {
new DownloadImageTask().execute("http://example.com/image.png");// Any time Taking Event.
}
private class DownloadImageTask extends AsyncTask {
protected Bitmap doInBackground(String... urls) {
return loadImageFromNetwork(urls[0]);
}
protected void onPostExecute(Bitmap result) {
mImageView.setImageBitmap(result);
}
}
Upvotes: 0
Reputation: 6635
This is actually ANR (Activity not responding)
your activity is taking long enough to execute the task you provided
Below links have info regarding how to force it to be responsive thru THREADS
.
You should execute heavy log running tasks in seperate THREAD
or Async Task
Simlar Problen in SO with solution Here
and
Upvotes: 2
Reputation: 15535
This error is because of your avd took long time to run your Activity.
http://developer.android.com/training/articles/perf-anr.html
If you did any complex task in your UI thread your application will become very slow. to solve this problem you can use painless thread,painless thread.
taken from Blundell`s answer.
I hope this will help you.
Upvotes: 1