Не удалось установить из-за истечения времени ожидания в эмуляторе

При попытке установить .apk из Eclipse, будь то на эмулятор Android или на физическое устройство (через USB), я получаю "Не удалось установить * .apk на устройство" *: timeout & quot; ошибка. .Apk не найден ни на эмуляторе, ни на физическом устройстве (Samsung Galaxy S2, root).

Если я избегаю затмения и просто использую командную строку, я также не могу установить .apk.

Why a new post on this?

Есть несколько других сообщений 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".

Этот пост является длинным, поскольку шаги, которые я предпринял, являются длительными, как это было подтверждено ошибкой. Если вы не хотите читать или хотя бы сканировать этот пост, пожалуйста, не комментируйте.

My Environment

ОС HOST: Windows XP SP3

JAVA: Java SDK версия 1.6.0_32

ОКНА ОКРУЖАЮЩЕЙ СРЕДЫ:

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;...;

IDE: Eclipse (установлена классика) Индиго. Версия 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)

МОБИЛЬНЫЙ: Samsung Galaxy S2 под управлением Android Ice Cream Sandwhich (ICS) 4.0.3

ANT: 1.8.2

Steps I go through to produce the errors.

Используя 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, я получаю

[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!

В консоли 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

Иногда (возможно, я делаю немного разные шаги) я получаю:

[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!

Обратите внимание на «bind: Unknown error». Иногда эта ошибка случается, иногда нет.

Если я отсоединяю свой кабель Ethernet от моего аппаратного маршрутизатора, я получаю следующее:

[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!

Обратите внимание на & quot; Предупреждение: DNS-серверы не найдены & quot;

Используя Eclipse, чтобы попытаться установить .apk на физическое устройство (укорененный Samsung 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!

Та же ошибка, что и при попытке установить в эмулятор.

При использовании только командной строки и тем самым избегая 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

Candidate solutions i've tried

Затмение связано:

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).

Android связано:

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" /> 

Окружающая среда (ПК и телефон):

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. Other information

Некоторые команды adb работают.

Например, следующее заставляет танцевать экран эмулятора (как и ожидалось).

adb shell monkey -v 100

Я могу перечислить устройства и правильно восстановить их состояние с помощью

adb devices.

Таким образом, существует частичная связь между клиентом adb и демоном adb (через сервер adb).

Я относительно новичок в разработке Android. Однако я успешно установил .apks на эмулятор и на мое устройство около 6 месяцев назад (с компьютера WinXP, который я сейчас пытаюсь заставить работать). Я игнорировал Android с тех пор. Когда я недавно вернулся к нему, у меня возникли некоторые проблемы при создании моих .apks, которые были исправлены путем удаления моего debug.key и разрешения eclipse генерировать новый.

За прошедшие 6 месяцев моя машина разработки изменилась во всех отношениях. Установка новых серверов и приложений, изменение настроек брандмауэра и т. Д. Таким образом, вполне могут произойти некоторые изменения, которые я пропускаю.

У меня также есть ноутбук с Win7, с которого я успешно установил .apks на эмулятор и физическое устройство, подключенное через USB. То есть у меня на компьютере с Win7 установлена копия Android SDK, Eclipse, JAVA и т. Д. Так что я знаю, что у меня есть общие сведения о правильной процедуре правильной настройки.

Я могу установить .apk вручную, дважды щелкнув файл через ES File Explorer на моем телефоне (который подключается к моей машине для разработки беспроводным способом).

Final thoughts

Кажется, что есть проблема с клиентом adb, сервером adb или демоном adb при полном разговоре друг с другом.

У меня есть три гипотезы:

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. Updates to post

2012-06-22 18:55 (UTC):

Завершите переустановку (снова) Java, Eclipse и Android SDK с некоторыми изменениями в установке (например, установленный Java в корневой каталог; Android SDK в стандартную версию «Program Files \»; отключение всех программ безопасности во время установки).

Я отмечаю ошибку "Ошибка остановки сервера ADB (код -1)". в Android SDK Manager Журнал во время и установить различные части платформы / инструменты (через Manager).

2012-06-30 06:15 (UTC):

Повторно отрегулировано & quot; Мое окружение & quot; спецификации отражают последние тесты.

Ответы на вопрос(14)

Ваш ответ на вопрос