Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does eclipse hang when installing an apk to an android emulator?

I've looked at tons of similar questions on here but all of them either had a different issue (installing the .apk actually failed) or the solutions which worked for them have not worked for me, so I apologize if this question seems like a repost.

The issue I am having is that when I try to run an android application on an emulator in eclipse the apk never gets installed. The emulator itself works fine (all the default apps function properly, settings are correct, etc.) but the app I am trying to test is never installed onto the "phone." It never shows up in the app list or launches, and I never get a confirmation that installation completed. (The run configuration is set to launch the app)

Here is the relevant console output, with some names changed:

[2011-10-19 10:54:45 - dining-android] Android Launch! 
[2011-10-19 10:54:45 - dining-android] adb is running normally.
[2011-10-19 10:54:45 - dining-android] Performing <src path>.Main activity launch
[2011-10-19 10:54:45 - dining-android] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD '1.5test'
[2011-10-19 10:54:45 - dining-android] Uploading <appname>.apk onto device 'emulator-5554'
[2011-10-19 10:54:59 - dining-android] Installing <appname>.apk...

It doesn't seem to make a difference whether I start the emulator manually and then try to run the app or if I run the app and let it start the emulator automatically, it will never go past this step. I left it running for about 8 hours (overnight) and nothing at all changed. The app is designated for the same version of android as the emulator runs, and everything looks correct in the settings of the emulator and eclipse as far as I can tell, except it never completes the installation of the app.

Does anyone know why this would happen? I've tried restarting adb, using different versions of the emulator and/or app, changing the default run configuration, and various other solutions I've come across on the internet which didn't seem to have any effect whatsoever. I'd really appreciate some help on this if anyone has run into something similar.

EDIT: I just tried using the "adb install" command in the command line on the .apk of the app while the emulator was running and it was also unsuccessful. I don't know whether this is related or another issue entirely.

EDIT2: Command line install using "adb install" functions properly. However, eclipse still can't manage to install the app. Anyone know what might cause this?

like image 255
matt5784 Avatar asked Oct 19 '11 16:10

matt5784


3 Answers

I had the same issue when I tried to run my android app in a device. Eclipse went to 100% of CPU usage and it did not respond anymore. I had to kill Java processes to close eclipse every time that I ran the app. As part of the workaround I removed android plugins from eclipse, updated my android binaries in my box and installing a fresh new eclipse . I killed adb server and restarted it several times. After all of that I had the same issue. The solution came when I tried with another phone and voilà... magically the problem was gone. I had been trying with a Samsung SIII(GTI9300 - OS 4.1.2) there was some issue with that phone because when I tried with a different phone Razor-I(XT890 - OS 4.0.4) . I used other SIII(GTI9300 - OS 4.1.2) and it worked too. Maybe the solution is not the best but was effective for me. If you have no chances to change the phone I recommend you to dig out in the configs of your phone with android binaries outside of eclipse.

I hope this helps.

like image 69
Ignacio Avatar answered Oct 24 '22 03:10

Ignacio


I had this problem before, I don't remember how I resolved it though (it was a while ago).

I personally suggest reinstalling the sdk and the ADT plugin, and make sure you're following the steps on the developer website. I'm not sure what signing the package has to do with eclipse not installing it on your phone or the emulator -- it only needs to be signed if you're going to have it up on the market (or if you're trying to install it on non-developer mode phones).

Another thing you could try is building a new android project (like a simple hello world app) and trying to install that. If it doesn't install then you're having an issue with eclipse and/or the sdk.

Also you could just completely wipe out eclipse and the sdk, and start from scratch. (Again, follow the directions on the android developer website...)

http://developer.android.com/sdk/eclipse-adt.html

http://www.eclipse.org/downloads/packages/eclipse-ide-java-developers/indigosr1

Good luck

like image 1
eplewis89 Avatar answered Oct 24 '22 04:10

eplewis89


I was fighting with same issue today. And thanks to eplewis89, he was suggesting right things. For me the problem was in ADT. I've updated my ASDK to highest version and ADT started to yell about it's compability and suggested to update itself too. But I chose only some parts that I thought will be enough to develop. Really this mistake cost me half of a day.

Help -> Check for Updates and update of all ADT stuff solved the problem.

like image 1
Alex T. Avatar answered Oct 24 '22 02:10

Alex T.