Android 由于模拟器超时,安装失败
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11115899/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Failed to install due to Timeout in Emulator
提问by John Bentley
When attempting to install an .apk from Eclipse, whether to an android emulator or to a physical device (via USB), I get a "Failed to install *.apk on device '*': timeout" error. The .apk is not found on the emulator nor physcial device (Samsung Galaxy S2, rooted).
尝试从 Eclipse 安装 .apk 时,无论是安装到 android 模拟器还是安装到物理设备(通过 USB),我都会收到“无法在设备上安装 *.apk '*':超时”错误。在模拟器和物理设备(三星 Galaxy S2,root)上都找不到 .apk。
If I avoid eclipse, and just use the command line, I'm also unable to install an .apk.
如果我避免使用 Eclipse,而只使用命令行,我也无法安装 .apk。
Why a new post on this?
为什么要发新帖呢?
There are several other stackoverflow posts that reference the "Failed to install..." error. I've created a new post for a few reasons:
还有其他几篇 stackoverflow 帖子引用了“无法安装...”错误。我创建了一个新帖子有几个原因:
- Most of the other posts are not detailed.
- The prominent relevant post, Android error: Failed to install *.apk on device *: timeout, for the original poster, applies only to physical device connections. So it is a different case, albeit with similar symptoms.
- All of the candidate solutions in that post, and several others, I have tried. These are listed bellow under "Candidate solutions i've tried".
- 大多数其他帖子都没有详细说明。
- 突出的相关帖子,Android error: Failed to install *.apk on device *: timeout,对于原始海报,仅适用于物理设备连接。所以这是一个不同的情况,尽管有相似的症状。
- 该帖子中的所有候选解决方案以及其他几个解决方案,我都尝试过。这些在“我尝试过的候选解决方案”下列出。
This post is lengthy as the steps I've taken are lengthy, as was warranted by the bug. If you don't want to read, or at least scan, this post please do not comment.
这篇文章很长,因为我采取的步骤很长,这是错误所保证的。如果您不想阅读或至少扫描,请不要评论此帖子。
My Environment
我的环境
HOST OS: Windows XP SP3
主机操作系统:Windows XP SP3
JAVA: Java SDK version 1.6.0_32
JAVA:Java SDK 版本 1.6.0_32
WINDOWS ENVIRONMENT VARIABLES:
WINDOWS 环境变量:
JAVA_HOME=C:\Program Files\Java\jdk1.6.0_33;
JAVA_HOME=C:\Program Files\Java\jdk1.6.0_33;
PATH=...;%JAVA_HOME%\bin\;C:\android\android-sdk\tools;C:\android\android-sdk\platform-tools\;...;C:\Program Files\apache-ant-1.8.2\bin;...;
PATH=...;%JAVA_HOME%\bin\;C:\android\android-sdk\tools;C:\android\android-sdk\platform-tools\;...;C:\Program Files\apache-ant-1.8.2\bin;...;
IDE: Eclipse (installed classic) Indigo. Version 3.7.2
IDE:Eclipse(安装经典)Indigo。版本 3.7.2
ANDROID SDK
安卓软件开发工具包
- Android SDK Tools Revision: 20. (Chiefly tested with revision 19).
- Android SDK Platform-tools: 11.
- ADT plug-in ("Android Development Toolkit", Eclipse Plugin) version: 20.0.0.v201206010423-369331 (also with prior version 18.0.0.v201203301501-306762).
- Platform targeted by your project & Version of the platform running in the emulator. Tried each off:
- Android 4.0.3 (API 15)
- Android 2.2 (API 8)
- Andorid 2.1 (API 7)
- Android SDK 工具修订版:20。(主要使用修订版 19 进行测试)。
- Android SDK 平台工具:11。
- ADT 插件(“Android 开发工具包”,Eclipse 插件)版本:20.0.0.v201206010423-369331(还有之前的版本 18.0.0.v201203301501-306762)。
- 您的项目所针对的平台和在模拟器中运行的平台版本。试过每一个:
- 安卓 4.0.3 (API 15)
- 安卓 2.2 (API 8)
- 安卓 2.1 (API 7)
MOBILE: Samsung Galaxy S2 running Android Ice Cream Sandwhich (ICS) 4.0.3
移动设备:运行 Android Ice Cream Sandwhich (ICS) 4.0.3 的三星 Galaxy S2
ANT: 1.8.2
蚂蚁:1.8.2
Steps I go through to produce the errors.
我通过的步骤来产生错误。
Using Eclipse to attempt to install an .apk to the emulator:
使用 Eclipse 尝试将 .apk 安装到模拟器:
- Open eclipse (which loads my workspace with a single android application in it).
- Run my android application using a previously configured Run configuration.
- The "Android Device Chooser" launches (I have set my Run configuration to launch this manually).
- In the Android Device Chooser I select my avd (targeting Android 2.2), and click OK.
- The emulator opens with "5554:jlbavd2_2". My AVD name is "jlbavd2_2".
- I leave the emulator open. In Eclipse I open the DDMS view. In the "Devices" pane I click on the white triangle and choose "Reset adb".
- 打开 eclipse(它加载我的工作区,其中包含一个 android 应用程序)。
- 使用先前配置的运行配置运行我的 android 应用程序。
- “Android 设备选择器”启动(我已将运行配置设置为手动启动)。
- 在 Android 设备选择器中,我选择我的 avd(针对 Android 2.2),然后单击确定。
- 模拟器以“5554:jlbavd2_2”打开。我的 AVD 名称是“jlbavd2_2”。
- 我让模拟器打开。在 Eclipse 中,我打开 DDMS 视图。在“设备”窗格中,我单击白色三角形并选择“重置 adb”。
In the Eclipse console, Android view, I get
在 Eclipse 控制台,Android 视图中,我得到
[2012-06-19 19:20:52 - MyApp] Starting full Post Compiler.
[2012-06-19 19:20:52 - MyApp] ------------------------------
[2012-06-19 19:20:52 - MyApp] Android Launch!
[2012-06-19 19:20:52 - MyApp] adb is running normally.
[2012-06-19 19:20:52 - MyApp] Performing au.com.myorg.myapp.MyAppActivity activity launch
[2012-06-19 19:20:52 - MyApp] Refreshing resource folders.
[2012-06-19 19:20:52 - MyApp] Starting incremental Pre Compiler: Checking resource changes.
[2012-06-19 19:20:52 - MyApp] Nothing to pre compile!
[2012-06-19 19:20:53 - MyApp] Starting incremental Package build: Checking resource changes.
[2012-06-19 19:20:53 - MyApp] Skipping over Post Compiler.
[2012-06-19 19:20:59 - MyApp] Launching a new emulator with Virtual Device 'jlbavd'
[2012-06-19 19:22:29 - MyApp] New emulator found: emulator-5554
[2012-06-19 19:22:29 - MyApp] Waiting for HOME ('android.process.acore') to be launched...
[2012-06-19 19:22:44 - MyApp] HOME is up on device 'emulator-5554'
[2012-06-19 19:22:44 - MyApp] Uploading MyApp.apk onto device 'emulator-5554'
[2012-06-19 19:22:49 - MyApp] Failed to install MyApp.apk on device 'emulator-5554': timeout
[2012-06-19 19:22:49 - MyApp] Launch canceled!
In the Eclipse console, DDMS output, I get:
在 Eclipse 控制台的 DDMS 输出中,我得到:
...
[2012-06-19 19:22:44 - ddm-hello] handling HELO
[2012-06-19 19:22:44 - ddm-hello] HELO: v=1, pid=150, vm='Dalvik v1.2.0', app='android.process.acore'
[2012-06-19 19:22:44 - MyApp.apk] Uploading MyApp.apk onto device 'emulator-5554'
[2012-06-19 19:22:44 - Device] Uploading file onto device 'emulator-5554'
[2012-06-19 19:22:49 - ddms] write: timeout
[2012-06-19 19:22:49 - Device] Error during Sync: timeout.
[2012-06-19 19:22:49 - ddms] Removing req 0x4000002d from set
Sometimes (perhaps I do slightly different steps) I get:
有时(也许我做的步骤略有不同)我得到:
[2012-06-16 14:20:02 - MyFirstApp02] Starting full Post Compiler.
[2012-06-16 14:20:02 - MyFirstApp02] ------------------------------
[2012-06-16 14:20:02 - MyFirstApp02] Android Launch!
[2012-06-16 14:20:02 - MyFirstApp02] adb is running normally.
[2012-06-16 14:20:02 - MyFirstApp02] Performing au.com.myorg.MyFirstApp02Activity activity launch
[2012-06-16 14:20:08 - MyFirstApp02] Launching a new emulator with Virtual Device 'jlbavd2_2'
[2012-06-16 14:20:17 - Emulator] bind: Unknown error
[2012-06-16 14:20:17 - MyFirstApp02] New emulator found: emulator-5556
[2012-06-16 14:20:17 - MyFirstApp02] Waiting for HOME ('android.process.acore') to be launched...
[2012-06-16 14:20:38 - MyFirstApp02] HOME is up on device 'emulator-5556'
[2012-06-16 14:20:38 - MyFirstApp02] Uploading MyFirstApp02.apk onto device 'emulator-5556'
[2012-06-16 14:20:50 - MyFirstApp02] Failed to install MyFirstApp02.apk on device 'emulator-5556': timeout
[2012-06-16 14:20:50 - MyFirstApp02] Launch canceled!
Note the "bind: Unknown error". Sometimes this error happens, sometimes it does not.
请注意“绑定:未知错误”。有时会发生此错误,有时不会。
If I unplug my ethernet cable to my hardware router I get the following:
如果我将以太网电缆拔出到我的硬件路由器,我会得到以下信息:
[2012-06-19 23:27:29 - MyApp] Android Launch!
[2012-06-19 23:27:29 - MyApp] adb is running normally.
[2012-06-19 23:27:29 - MyApp] Performing au.com.softmake.myapp.MyAppActivity activity launch
[2012-06-19 23:27:29 - MyApp] Refreshing resource folders.
[2012-06-19 23:27:29 - MyApp] Starting incremental Pre Compiler: Checking resource changes.
[2012-06-19 23:27:29 - MyApp] Nothing to pre compile!
[2012-06-19 23:27:33 - MyApp] Launching a new emulator with Virtual Device 'jlbavd'
[2012-06-19 23:27:40 - Emulator] Warning: No DNS servers found
[2012-06-19 23:27:44 - Emulator] emulator: emulator window was out of view and was recentered
[2012-06-19 23:27:44 - Emulator]
[2012-06-19 23:28:29 - MyApp] New emulator found: emulator-5554
[2012-06-19 23:28:29 - MyApp] Waiting for HOME ('android.process.acore') to be launched...
[2012-06-19 23:28:36 - MyApp] HOME is up on device 'emulator-5554'
[2012-06-19 23:28:36 - MyApp] Uploading MyApp.apk onto device 'emulator-5554'
[2012-06-19 23:28:42 - MyApp] Failed to install MyApp.apk on device 'emulator-5554': timeout
[2012-06-19 23:28:42 - MyApp] Launch canceled!
Note the "Warning: No DNS servers found"
请注意“警告:未找到 DNS 服务器”
Using Eclipse to attempt to install an .apk to a physical device (rooted Samsung Galaxy S2. 4.0.3 with USB debugging enabled), and after going through similar steps as above, I get in the Eclipse console, Android Output:
使用 Eclipse 尝试将 .apk 安装到物理设备(根植于三星 Galaxy S2。4.0.3 并启用 USB 调试),在完成上述类似步骤后,我进入了 Eclipse 控制台,Android 输出:
[2012-06-15 22:40:34 - MyFirstApp] Starting full Post Compiler.
[2012-06-15 22:40:34 - MyFirstApp] ------------------------------
[2012-06-15 22:40:34 - MyFirstApp] Android Launch!
[2012-06-15 22:40:34 - MyFirstApp] adb is running normally.
[2012-06-15 22:40:34 - MyFirstApp] Performing
au.com.myorg.myfirstapp.MyFirstAppActivity activity launch
[2012-06-15 22:40:39 - MyFirstApp] Uploading MyFirstApp.apk onto device '0019adf659f24e'
[2012-06-15 22:40:51 - MyFirstApp] Failed to install MyFirstApp.apk on device '0019adf659f24e': timeout
[2012-06-15 22:40:51 - MyFirstApp] Launch canceled!
The same sort of error as when attempting to install to the emulator.
与尝试安装到模拟器时的错误类型相同。
When using the command line only, and thereby avoiding Eclipse, I go through the following steps:
仅使用命令行并因此避免使用 Eclipse 时,我会执行以下步骤:
Open a windows command prompt in my working directory (I'm using C:\Data\Sda\Code\Mobile\Android\Examples>").
android list targets.
I obtain my target id (I choose Android 2.2).
android create project --target 3 --name MyAppCmd --path ./MyAppCmd --activity MyAppCmdActivity --package au.com.myorg.myappcmd
I get a series of healthy looking output "Created project directory ...", "Added file ..."
- In windows I double click "AVD Manager.exe".
- I launch my avd (which targets Android 2.2)
Back to my command window
cd MyAppCmd
ant debug
After a list of output I get "BUILD SUCCESSFUL ..." (On a prior occasion I had to edit C:\android\android-sdk\platform-tools\dx.bat to change "set defaultXmx=-Xmx1024M" to "set defaultMx=-Xmx512M" to make the build successful ). I observe that bin/MyAppCmd-debug.apk exists.
I attempt an install with
adb install bin/MyAppCmd-debug.apk
Output:
* daemon not running. starting it now on port 5037 * * daemon started successfully * error: device offline
adb devices
List of devices attached emulator-5554 device
adb install bin/MyAppCmd-debug.apk
There is no further output in the command window. No error message. Just a blinking cursor, no error or success message, and no return to the command prompt ">".
I shut down the command line and open a new one.
I get the same result (a blinking cursor, etc.) if I try a push command (temp.txt has been previously created on my windows system) ...
adb push temp.txt /sdcard/temp.txt
在我的工作目录中打开 Windows 命令提示符(我使用的是 C:\Data\Sda\Code\Mobile\Android\Examples>”)。
android 列表目标。
我获得了我的目标 ID(我选择了 Android 2.2)。
android 创建项目 --target 3 --name MyAppCmd --path ./MyAppCmd --activity MyAppCmdActivity --package au.com.myorg.myappcmd
我得到了一系列看起来很健康的输出“创建的项目目录...”、“添加的文件...”
- 在 Windows 中,我双击“AVD Manager.exe”。
- 我启动了我的 avd(针对 Android 2.2)
回到我的命令窗口
cd MyAppCmd
蚂蚁调试
在输出列表后,我得到“BUILD SUCCESSFUL ...”(之前我不得不编辑 C:\android\android-sdk\platform-tools\dx.bat 以将“set defaultXmx=-Xmx1024M”更改为“设置 defaultMx=-Xmx512M" 以使构建成功)。我观察到 bin/MyAppCmd-debug.apk 存在。
我尝试安装
adb install bin/MyAppCmd-debug.apk
输出:
* daemon not running. starting it now on port 5037 * * daemon started successfully * error: device offline
亚行设备
List of devices attached emulator-5554 device
adb install bin/MyAppCmd-debug.apk
命令窗口中没有进一步的输出。没有错误信息。只是一个闪烁的光标,没有错误或成功消息,也没有返回命令提示符“>”。
我关闭命令行并打开一个新的。
如果我尝试推送命令(之前在我的 Windows 系统上创建了 temp.txt),我会得到相同的结果(闪烁的光标等)......
adb push temp.txt /sdcard/temp.txt
Candidate solutions i've tried
我尝试过的候选解决方案
Eclipse related:
日食相关:
- Followed the steps from Eclipse isn't talking to the emulator
- Increased the ADB connection time out. Eclipse > Window > Preferences > Android > DDMS > " ADB connection time out(ms):" = 10000 (I've also tried 60000).
- Running the application twice (and choosing the currently running emulator or mobile phone again).
- Cleaned my project: Eclipse > Project > Clean ...
- Rebooted Eclipse.
- Downgraded Eclipse from Indigo (2.7.x) to Helios (2.6.x).
- 遵循Eclipse 中的步骤不与模拟器交谈
- 增加了 ADB 连接超时。Eclipse > Window > Preferences > Android > DDMS > "ADB connection time out(ms):" = 10000(我也试过 60000)。
- 运行应用程序两次(并再次选择当前运行的模拟器或手机)。
- 清理我的项目:Eclipse > 项目 > 清理 ...
- 重新启动 Eclipse。
- 将 Eclipse 从 Indigo (2.7.x) 降级到 Helios (2.6.x)。
Android related:
安卓相关:
- Reset the adb in several ways: "Reset ADB" command from the Eclipse DDMS perspective (from the Devices window triangle); command line with "adb kill-server" and "adb start-server"; and using the Windows Task manager to kill adb.exe.
- Reinstalling my Samsung OEM USB drivers (By using KIES > Tools > Troubleshoot connection error).
- Installing my Android SDK to a directory without spaces anywhere in the paths. Namely C:\Android\android-sdk. This entailed a reinstall of the SDK, formerly located at C:\Program files\Android\android-sdk
- My Android Project is installed in a directory without spaces anywhere in the the path.
- Deleting and recreating the avd (both from the Android AVD Manager and using Windows Explorer).
- Using different AVDs that target different platfroms (Android 2.2 and Android 4.0.3).
- Just after the Emulator opens but before it times out: unlocking the phone V waiting till it times out with the phone locked (in the emulator).
Verified I have in my AndroidManifest.xml:
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8" />
- 以多种方式重置 adb: 从 Eclipse DDMS 角度(从设备窗口三角形)的“重置 ADB”命令;带有“adb kill-server”和“adb start-server”的命令行;并使用 Windows 任务管理器杀死 adb.exe。
- 重新安装我的三星 OEM USB 驱动程序(通过使用 KIES > Tools > Troubleshoot connection error)。
- 将我的 Android SDK 安装到路径中任何地方都没有空格的目录中。即 C:\Android\android-sdk。这需要重新安装 SDK,以前位于 C:\Program files\Android\android-sdk
- 我的 Android 项目安装在路径中任何地方都没有空格的目录中。
- 删除和重新创建 avd(从 Android AVD 管理器和使用 Windows 资源管理器)。
- 使用针对不同平台(Android 2.2 和 Android 4.0.3)的不同 AVD。
- 就在模拟器打开之后但在超时之前:解锁手机 V 等待手机锁定(在模拟器中)超时。
验证我在我的 AndroidManifest.xml 中有:
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8" />
Environment related (PC and Phone):
环境相关(PC和手机):
- Rebooted My Phone.
- Rebooted my development PC.
- Turning off my software and hardware firewall.
- Turning of MS Security Essentials Real Time Protection.
- Disabled my hosts list.
- Reinstalled Java.
- Booting into Windows safe mode and running Eclipse.
- Manually killing most other application TCP/IP Processes (E.g GoogleDesk.exe, Apache Server PunkBuster, etc) by seeing what is available in Sysinternals TCPView.
- Disconnected the Ethernet cable from my PC.
- 重新启动了我的手机。
- 重新启动我的开发电脑。
- 关闭我的软件和硬件防火墙。
- 开启 MS Security Essentials 实时保护。
- 禁用我的主机列表。
- 重装Java。
- 启动到 Windows 安全模式并运行 Eclipse。
- 通过查看Sysinternals TCPView 中的可用内容,手动终止大多数其他应用程序 TCP/IP 进程(例如 GoogleDesk.exe、Apache Server PunkBuster 等)。
- 从我的 PC 上断开以太网电缆。
Other information
其他信息
Some adb commands work.
一些 adb 命令有效。
For example the following makes the emulator screen dance about (as is expected).
例如,以下内容使模拟器屏幕跳舞(正如预期的那样)。
adb shell monkey -v 100
adb shell 猴子 -v 100
I can list the devices, and correctly retrieve their state with
我可以列出设备,并正确检索它们的状态
adb devices.
adb 设备。
So there is partial communication between an adb client and adb daemon (via an adb server).
因此 adb 客户端和 adb 守护进程(通过 adb 服务器)之间存在部分通信。
I am relatively new to Android development. However, I have successfully installed .apks to the emulator and my device about 6 months ago (from the WinXP PC I'm now trying to make work). I have ignored Android since then. When I came back to it recently I had some problem building my .apks which was fixed by deleting my debug.key and allowing eclipse to generate a new one.
我对 Android 开发比较陌生。但是,大约 6 个月前,我已经成功地将 .apks 安装到了模拟器和我的设备上(我现在正在尝试使用 WinXP PC)。从那以后我就忽略了Android。当我最近回到它时,我在构建我的 .apks 时遇到了一些问题,通过删除我的 debug.key 并允许 eclipse 生成一个新的来解决这个问题。
In the intervening 6 months my development machine has changed in all sorts of ways. Installing new servers and apps, changing firewall settings etc. So there could well be some change I'm overlooking.
在这中间的 6 个月里,我的开发机器发生了各种变化。安装新的服务器和应用程序,更改防火墙设置等。所以我很可能会忽略一些变化。
I also have a Win7 Laptop from which I have successfully installed .apks to the emulator and USB connected physical device. That is, I have a copy of the Android SDK, Eclipse, JAVA, etc installed on the Win7 machine. So I know I have a general handle on the correct procedure for setting it all up correctly.
我还有一台 Win7 笔记本电脑,我已经成功地将 .apks 安装到了模拟器和 USB 连接的物理设备上。也就是说,我在Win7机器上安装了Android SDK,Eclipse,JAVA等的副本。所以我知道我对正确设置它的正确程序有一个一般性的处理。
I can install the .apk manually by double clicking the file through ES File Explorer from my Phone (which connects to my development machine wirelessly).
我可以通过从我的手机(无线连接到我的开发机器)通过 ES 文件资源管理器双击文件来手动安装 .apk。
Final thoughts
最后的想法
It seems that there is some problem with the adb client, adb server, or adb daemon in talking to each other fully.
似乎 adb 客户端、adb 服务器或 adb 守护程序在相互充分通信时存在一些问题。
I have three hypothesis:
我有三个假设:
- It is my fault. That there is some kind of TCP/IP conflict which breaks some of the connections between the adb client, adb server, or adb daemon. This is due to some freakish setting on my PC (like any developer I change various settings on my system all the time). However, I have tried disabling security and other potentially conflicting TCP/IP processes (as far as I can tell).
- Some simple issue I keep overlooking.
- It is google's/Android's fault. That is, there is a bug in the Android adb which requires an update to the android SDK platform tools. I think this less likely since I'd expect it to have surfaced by now.
- 这是我的错。存在某种 TCP/IP 冲突,导致 adb 客户端、adb 服务器或 adb 守护程序之间的某些连接中断。这是由于我的 PC 上的一些奇怪的设置(就像任何开发人员一样,我一直在我的系统上更改各种设置)。但是,我已尝试禁用安全性和其他可能发生冲突的 TCP/IP 进程(据我所知)。
- 一些我一直忽略的简单问题。
- 这是谷歌/安卓的错。也就是说,Android adb 中存在需要更新 android SDK 平台工具的错误。我认为这不太可能,因为我希望它现在已经浮出水面。
Updates to post
要发布的更新
2012-06-22 18:55 (UTC):
2012-06-22 18:55 (UTC):
Complete reinstall (again) of Java, Eclipse, and the Android SDK with some variations in the install (e.g. Installed Java to root; Android SDK to the default "Program Files\"; and turning off all security software during install).
完成(再次)Java、Eclipse 和 Android SDK 的重新安装,但在安装过程中会有一些变化(例如,将 Java 安装到 root;Android SDK 到默认的“Program Files\”;并在安装过程中关闭所有安全软件)。
I note an error "Stopping ADB server failed (code -1)." in the Android SDK Manager Log during and install of the various parts of the platform/tools (via the Manager).
我注意到一个错误“停止 ADB 服务器失败(代码 -1)”。在 Android SDK 管理器日志中并安装平台/工具的各个部分(通过管理器)。
2012-06-30 06:15 (UTC):
2012-06-30 06:15 (UTC):
Readjusted "My Environment" specs to reflect latest tests.
重新调整“我的环境”规格以反映最新测试。
采纳答案by John Bentley
I've solved the problem, many months later, by upgrading to a completely new environment. Specifically, a new machine with a fresh install of Windows 8. I've also avoided installing the Comodo suite (I don't know that this was causing the problem).
几个月后,我通过升级到一个全新的环境解决了这个问题。具体来说,是一台全新安装了 Windows 8 的新机器。我也避免安装 Comodo 套件(我不知道这是导致问题的原因)。
So while this is not a direct solution to the problem (it's still not clear what was causing it) perhaps it might serve as another example where a workaround or lateral resolution to a problem is sometimes a good last resort option.
因此,虽然这不是问题的直接解决方案(仍然不清楚是什么原因造成的),但它可能可以作为另一个例子,其中解决问题的方法或横向解决方案有时是最后的不错选择。
回答by mayank_droid
If its timeout then may be ADB connection with the eclipse will need more timeout limit. So Try this:
如果它的超时那么可能是与 eclipse 的 ADB 连接将需要更多的超时限制。所以试试这个:
Prefrences>android>DDMS and you will see ADB connection timeout extend it to 20000
Prefrences>android>DDMS and you will see ADB connection timeout extend it to 20000
回答by PhilosophicalRaptor
Make sure your working on an ADMIN ACCOUNT. This problem also frustrated me, but when I switched over to an admin account (on Windows Vista), the adb seemed to correctly install the apk on the device.
确保您使用的是管理员帐户。这个问题也让我感到沮丧,但是当我切换到管理员帐户(在 Windows Vista 上)时,adb 似乎在设备上正确安装了 apk。
回答by Zachary Moshansky
When this happen's to us on physical devices we usually attempt to fix it by unplugging, toggling "android debug mode" on the device and reconnecting.
当我们在物理设备上发生这种情况时,我们通常会尝试通过拔下、切换设备上的“android 调试模式”并重新连接来修复它。
回答by ronensima
I had the same issue; by copying the *.apk to the cell phone memory and installing it directly on the device (by Myfiles and selecting the *.apk), it worked OK. I suspect that there's an issue with the USB connection (too many errors, Eclipse is too slow due to other processes using the USB, etc.).
我遇到过同样的问题; 通过将 *.apk 复制到手机内存并将其直接安装在设备上(通过 Myfiles 并选择 *.apk),它工作正常。我怀疑 USB 连接有问题(错误太多,由于其他进程使用 USB 导致 Eclipse 速度太慢等)。
回答by Anchal Radhwani
Try changing the ADB connection timeout. I think it defaults that to 5000ms and I changed mine to 10000ms to get rid of that problem.
尝试更改 ADB 连接超时。我认为它默认为 5000 毫秒,我将我的更改为 10000 毫秒以解决该问题。
If you are in Eclipse, you can do this by going through
如果你在 Eclipse 中,你可以通过
Window-> Preferences -> Android -> DDMS -> ADB Connection Timeout (ms)
Window-> Preferences -> Android -> DDMS -> ADB Connection Timeout (ms)
回答by Stark
My simple approach is to just restart the emulator (not eclipse). It just works without me having to send any adb commands. Rarely happens with physical device though.
我的简单方法是重新启动模拟器(而不是 eclipse)。它无需我发送任何 adb 命令即可工作。虽然很少发生在物理设备上。
回答by Kumar Vivek Mitra
Try these...
试试这些...
- Shut Down your eclipse.
- Goto cmd and type:(I hope you have set the path of android tools folder in your path)
- 关闭你的日食。
- 转到cmd并键入:(我希望您已在路径中设置了android工具文件夹的路径)
adb kill-server
adb start-server
adb kill-server
adb start-server
output will be:
输出将是:
daemon not running. starting it now on port 5037
daemon started successfully
Start you Eclipse.
Start your emulator, if you are on physical device, see that your cable is not loose, and properly connected
启动 Eclipse。
启动您的模拟器,如果您在物理设备上,请查看您的电缆是否松动并正确连接
回答by android_begginer94
Just unplugging and plugging in the phone (physical) works. This does happen to me (too many times) when the phone is connected too long and nothing is done.
只需拔下和插入电话(物理)即可。当电话连接时间过长而什么也没做时,这确实发生在我身上(太多次)。
回答by Marcelo
I've got the same behavior as mentioned in your question, and tried every solution listed by you. Try this: change the USB port. For me, I have a total of 4 USB ports (two in front of my desktop and the two others in the back). The two ones on the front gives me [timeout install] whatever I do. The first one in the back I've tried has worked. I wonder it might be some issue related with USB port version, or MotherBoard embedded USB.
我的行为与您在问题中提到的行为相同,并尝试了您列出的所有解决方案。试试这个:改变USB端口。对我来说,我总共有 4 个 USB 端口(两个在我的桌面前面,另外两个在后面)。无论我做什么,前面的两个都给了我[超时安装]。我试过的后面的第一个成功了。我想这可能是与 USB 端口版本或主板嵌入式 USB 相关的一些问题。