简体   繁体   English

使用模拟器时keyDispatchingTimedOut

[英]keyDispatchingTimedOut while using emulator

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 谢谢

This is actually ANR (Activity not responding) 这实际上是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 . 下面的链接有关于如何强制它通过THREADS响应的信息。

You should execute heavy log running tasks in seperate THREAD or Async Task 您应该在单独的THREADAsync Task执行繁重的日志运行任务

Simlar Problen in SO with solution Here 解决方案中的模拟问题解决方案

and

Here 这里

This error is because of your avd took long time to run your Activity . 此错误是因为您的avd花了很长时间来运行您的Activity

http://developer.android.com/training/articles/perf-anr.html 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. 如果您在UI线程中执行了任何复杂任务,您的应用程序将变得非常慢。 to solve this problem you can use painless thread , painless thread . 要解决这个问题你可以使用无痛线程无痛线程

taken from Blundell `s answer. 取自Blundell的回答。

I hope this will help you. 我希望这能帮到您。

  • 1) You might have used thread.sleep() in your UI thread. 1)您可能在UI线程中使用了thread.sleep()。 That is not cool and android just kicks your activity. 这并不酷,Android只会踢你的活动。

  • 2) You are doing some massive bad ass computation in your UI thread. 2)你在UI线程中做了一些大规模的坏人计算。 Use an AsyncTask or a Thread. 使用AsyncTask或Thread。

  • 3) The emulator is sometimes slower than a phone. 3)模拟器有时比手机慢。

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". 通常,如果Activity无法告诉Android操作系统“我还活着”,则会触发ANR。 android Developer . android开发者

You need to execute in Async manner. 您需要以异步方式执行。 So for an instance if you want to do some long waiting process onClick() . 所以对于一个实例,如果你想在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);
     }
 }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用EMulator使用Android驱动程序时出错 - Error while using Android Driver using EMulator 在设备Apple iPhone 5上使用Chrome模拟器(Chrome驱动程序)时,如何自动执行文件下载? - How to automate file downloads, while using chrome emulator (chrome driver) with device apple iPhone 5? 使用Google Maps Api V2时,Android 2.2或4.1.2模拟器上的Google Play服务缺失 - Google Play Services Missing on Android 2.2 or 4.1.2 Emulator while using Google Maps Api V2 在设备/仿真器中运行时,应用程序崩溃 - Application crashes while running in Device/Emulator 读取大型txt文件时在模拟器上出现OutOfMemoryError - OutOfMemoryError on emulator while reading large txt file 模拟器无法启动:等待设备时出错 - Emulator wont launch: Error while waiting for device libgdx游戏可在调试时运行,但不能在模拟器上运行 - libgdx game works while debugging but not on emulator 面临致命异常:在模拟器上运行时主要 - Facing FATAL EXCEPTION: main while running on emulator 处理命令时发生未知的服务器端错误。 原始错误:未知错误:无法使用模拟器浏览器聚焦元素 - An unknown server-side error occurred while processing the command. Original error: unknown error: cannot focus element using emulator browser 使用 Android 模拟器从 eclipse 执行简单的 Appium 脚本时遇到问题,请帮我确定问题 - Getting issue while Executing simple Appium Script from eclipse using Android Emulator , Please help me identify the issue
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM