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).
If I avoid eclipse, and just use the command line, I'm also unable to install an .apk.
There are several other stackoverflow posts that reference the "Failed to install..." error. I've created a new post for a few reasons:
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.
HOST OS: Windows XP SP3
JAVA: Java SDK version 1.6.0_32
WINDOWS ENVIRONMENT VARIABLES:
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 (installed classic) Indigo. Version 3.7.2
ANDROID SDK
MOBILE: Samsung Galaxy S2 running Android Ice Cream Sandwhich (ICS) 4.0.3
ANT: 1.8.2
Using Eclipse to attempt to install an .apk to the emulator:
In the Eclipse console, Android view, I get
[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:
... [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"
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:
[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:
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 ..."
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
Eclipse related:
Android related:
Verified I have in my AndroidManifest.xml:
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8" />
Environment related (PC and Phone):
Some adb commands work.
For example the following makes the emulator screen dance about (as is expected).
adb shell monkey -v 100
I can list the devices, and correctly retrieve their state with
adb devices.
So there is partial communication between an adb client and adb daemon (via an adb server).
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.
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.
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.
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).
It seems that there is some problem with the adb client, adb server, or adb daemon in talking to each other fully.
I have three hypothesis:
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).
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).
2012-06-30 06:15 (UTC):
Readjusted "My Environment" specs to reflect latest tests.
If the emulator fails to launch due to the error vulkan-1. dll cannot be found , you probably need to update the emulator. To update the emulator in Android Studio, go to Tools > SDK Manager and install the latest stable version of Android platform.
If its timeout then may be ADB connection with the eclipse will need more timeout limit. So Try this:
Prefrences>android>DDMS and you will see ADB connection timeout extend it to 20000
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With