开发者

Android Failed to install HelloWorld.apk on device (null) Error

I am new to Android. When I am running my android application in eclipse I am getting these messages in the console:

[2011-03-08 12:57:35 - HelloWorld] ------------------------------
[2011-03-08 12:57:35 - HelloWorld] Android Launch!
[2011-03-08 12:57:35 - HelloWorld] adb is running normally.
[2011-03-08 12:57:35 - HelloWorld] Performing com.oreilly.helloworld.HelloWorldActivity activity launch
[2011-03-08 12:57:35 - HelloWorld] Automatic Target Mode: Preferred AVD 'MY_AVD' is not available. Launching new emulator.
[2011-03-08 12:57:35 - HelloWorld] Launching a new emulator with Virtual Device 'MY_AVD'
[2011-03-08 12:57:39 - HelloWorld] New emulator found: emulator-5554
[2011-03-08 12:57:39 - HelloWorld] Waiting for HOME ('android.process.acore') to be launched...
[2011-03-08 13:00:14 - HelloWorld] WARNING: Application does not specify an API level requirement!
[2011-03-08 13:00:14 - HelloWorld] Device API version is 11 (Android 3.0)
[2011-03-08 13:00:14 - HelloWorld] HOME is up on device 'emulator-5554'
[2011-03-08 13:00:14 - HelloWorld] Uploading HelloWorld.apk onto device 'emulator-5554'
[2011-03-08 13:00:14 - HelloWorld] Installing HelloWorld.apk...
[2011-03-08 13:02:22 - HelloWorld] Failed to install HelloWorld.apk on device 'emulator-5554!
[2011-03-08 13:02:22 - HelloWorld] (null)
[2011-03-08 13:02:23 - HelloWorld] Launch canceled!

How do I resolve the problems so that my application wi开发者_开发技巧ll launch?


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. If you are in Eclipse, you can do this by going through Window -> Preferences and then it is in DDMS under Android.

As described here: Android error: Failed to install *.apk on device *: timeout


Restarting the device works for me. Using adb install can get the apk installed, but it's annoying to use it everytime you launch the app when debugging within eclipse.


I get this from time to time, but it's usually related to the emulator being slow to start. Try again without closing the emulator between the retries. And if it still fails, please post the client logs (logcat).

Another reason can be a ghost Eclipse process running in background and still bound to the debugging port. Close eclipse, look at process list and see if there's still an Eclipse running. Kill all of them and restart Eclipse again.


If you are running it on an Android Emulator you do not want to close it between runs. The system will try to load the app and it will time out because of how long it takes the emulator to boot up. You can fix this by increasing the ADB time by going to Window -> Preferences -> Android -> DDMS and increasing the ADB time out (default is 5000ms) or by leaving the emulator open and just running it after the emulator is up and running.

I personally would recommend leaving the emulator open as it does load the apps relatively quickly once it is running, but it could be a drain on the system. Do whichever would help you more.


Something else you might want to consider is a hard reset of your emulator by wiping your user data.

In order to do this you: - right click your project name in package explorer - go to 'run as' then 'run configuration' - in the 'run configuration' window click the 'target' tab - then tick the name of your chosen emulator - tick 'wipe user data', click apply

And the next time you start up your emulator it should prompt you asking whether you really want to wipe your data. Click yes, and hopefully it helps you to install the app.


I had the same problem and solved it by adding the paths of Android SDK folder tools and platform-tools to system PATH variable then restarting the device.


@Bolton 's answer worked for me. Some details...

I got my phone a few weeks ago. I tried the HelloAndroid sample app right away (after installing req'd software, etc.). The app worked in the emulator AND on the phone--right away!

Shortly after that, I rooted my phone but did not flash any roms or kernels. I was only experimenting on the emulator until yesterday (writing a simple notepad app). When I tried debugging the app on the phone, here's what I observed:

  1. Eclipse console reported the "...failed to install on device...(null)" message. BUT

  2. The HelloAndroid app DID get pushed to the phone! (It appeared in the apps drawer AND I was able to launch it.)

  3. It simply would not launch on the phone from the Eclipse run.

I searched around here and elsewhere last night (including this thread) with no luck. Finally, I rebooted my phone--which I never tried (doh!) 'cause I didn't think it would make a difference--and the app launched from an Eclipse start!

Still don't know the cause, but I'll come back here if I figure it out.


I have the same problem: Failed to install test.apk on device 'xxxxxxxxx': null

I try to reboot phone, restart Eclipse, and nothing!

Then, I remove this project from Eclipse workspace, and import again. (File, Import, Existing project to workspace). I do not know exactly what the problem was, but now is working ok.


I ran into the same problem and tried increasing the ADB connection timeout... Didn't work.

I tried putting the "android-sdk/tools" and "android-sdk/platform-tools" in the PATH variable.... No effect.

I tried restarting Eclipse and letting the AVD startup before running. Same problem.

I can sometimes get it to work with a combination of closing and reopening the project, followed by cleaning and rebuilding the project. It doesn't always work, but since I didn't restart the AVD this last time, I think the problem lies within Eclipse itself. You might try deleting everything in the "bin" directory of your project and then cleaning and rebuilding. It might be some temporary or intermediate files not getting deleted properly. Another thing I had to do was delete my AVD. It didn't delete properly, and I had to go in and manually delete the AVD's subfolder and then re-create the AVD. Some combination of these clears the problem up temporarily. Hope that helps.


If unplugging the device and plugging it back in doesn't work, try increasing the upload timeout to something really huge like 20000 ms. It's at Window → Preferences → Android → DDMS → "ADB connection time out (ms)".


Just try the following steps,

  1. Go to Home screen before you start to run the application.
  2. No need to uninstall every time. Just uninstall your application once properly.

    Go to Setting -> Manage Application -> click menu -> filter -> Third party application. Check whether your application is there or not.

  3. After modifying your application just save it. Right click your project and select "Run as Android application".
  4. Note: once again, before running your application check whether or not your emulator is showing the home screen.

going to home screen: from eclipse go to menus: window->android virtual device->start


As for me, I had the same problem and it helped to increase SD volume and max VM app heap size. (Android SDK and AVD manager - Virtual device - Edit) What is interesting, the back change of SD and heap to the previous values is OK, too. That means, that any change of emulator parameters and its rebuilding is enough. (Simple restart won't help)


I had imported an existing project and started running... i too was facing the same problem (WARNING: Application does not specify an API Device API version is 11 (Android 3.0) ). After all my attempts to resolve that failed,I just created new project under other package to maintain the same names and copied all the file contents of the previously imporetd projects manually and again started running...to my surprise it successfully executed in my first attempt...i think the problem was due to the lack of compatibilty of versions when imported...i hope it may help few...


I was facing this problem time and again.Got around a lot of forums, but couldn't find a logical solution for the issue.

I used to get this error message, . . . Uploading test.apk onto device 'emulator-5554' Failed to install test.apk on device 'emulator-5554': timeout Launch canceled!

this error is thrown as the start of emulator and deployment of application takes some significant time and before that the emulator times out.

A simple fix for this problem is keeping the emulator open when this problem occurs, *just run the application again. This only deploys the application on to the already started emulator *. There is not much time consumed during this run as the major part of the time during app deployment is because of slow start up of emulator.

Hope this helps!


What Jichao said always works for me.

Generally when I see this error if I am using Eclipse I will close and reopen the program. I will then uninstall the Application from the target phone. This sometimes fixes the issue but not always.

Next I will open up the command terminal and head into the android-sdk then run:

./adb install <AppName>.apk

This does the same thing that running through Eclipse does but it will give you an error message.

(9 times out of 10 it simply says 'INSTALL_ALREADY_EXISTS' and I go and uninstall the application off the target phone again then run adb and I am working fine.)


I was getting the same error.

I Just left the AVD running even after it says "Failed to install *.apk on device-emulator-5554". It automatically loaded the project afterwards.

I think the error comes due the slow start up of the AVD.


I was getting the same errors with my devices.
First be sure that you do not upload debug apk to a device having already installed the same apk but signed with release cert. In this case you've got to uninstall it first from the device.
In other cases my solution is to reboot everything:

  1. reboot device
  2. pskill emulator-arm.exe
  3. pskill eclipse.exe
  4. pskill adb.exe

After that the device, adb and eclipse are working.


When it shows the red writing - the error , don't close the emulator - leave it as is and run the application again.


restart the ADT or 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. If you are in Eclipse, you can do this by going through Window -> Preferences and then it is in DDMS under Android.


OK, this approach will only be useful when you are connecting to a real device rather than to an Android emulator.

Resetting the DDMS ADB connection timeout won't work nicely with a real device when there is a problem with USB debugging mode of the device.

So, disabling and re-enabling USB debugging mode seems to resolve the issue by creating a new fresh ADB session on the device.


go setting- security verify apps if checked, change to unchecked status, then change to checked status


1) remove the apk from this directory project/build/outputs/apk

2) If you using genymotion emulator restart the genymotion

3) make project & rebuild the project

4) Run Again

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜