2

I am having a problem in running my app in Emulator. There are no errors or warnings in the code, its running perfect in device, but when it comes to emulator, it always crashes and the error message would be like this

[2012-01-16 16:13:55 - MyApp] Failed to install MyApp.apk on device 'emulator-5554!

[2012-01-16 16:13:55 - MyApp] (null)

[2012-01-16 16:13:55 - MyApp] Launch canceled!

I have tried the following things:

  1. Run configurations > Target > Wipe user data > Run

  2. Uninstalling the app and run it again

  3. Restarting the emulator

  4. adb kill-server && adb start-server

  5. Creating a new Emulator and running the app in it

  6. Restarting ADB

  7. Restarting Eclipse

  8. Starting the Eclipse after the emulator is launched completely

  9. Increasing the ADB connection time-out to 1000

  10. Restarting the System

  11. Deleted the emulators and created new emulators and run in it after they are completely loaded

I don't know what else should I do. Sometimes if I run in a new Emulator the app runs for the first time and if I run it again after sometime, its the same crash report. I am not able to understand what is the problem.

Can anyone please suggest me what should I do now and where is the problem? The Emulator used to work well before. This problem started a few days back.

Any help will be appreciated. Thanks All.

Lavanya
  • 3,903
  • 6
  • 31
  • 57

9 Answers9

1

More possibilities:

  • Real refresh of AVD. It is funny, but Eclipse remembers your emulator. And if you turn it off and on it will be the same old good (or bad) one. You could reinstall all Eclipse for a real refresh. Or use a shorter, but tricky way. Change the max VM app heap size of the emulator. (Android SDK and AVD manager - Virtual device - Edit) Create it. Now you have a brand new emulator. Funny, isn't it? Now you can change the heap size back, if you wish.

Really, I think, you can maybe change any emulator parameter for the effect. Only I stumbled upon it by heap size and stuck to do it this way.

  • Try to repair the path.

Set the path environment variable with the path of "platform-tools" and "tools" found in the "sdk-home".

On windows(vista):- 1.Go to "Control Panel\System". 2.Select "Advanced System Settings". 3.Select the "Environment variable". 4.Set the path environment variable under the system variable with values "SDKHOME\platform-tools;SDKHOME\tools". Where "SDKHOME" is the home folder of Android sdk.

  • Check,if APK version of the application sits with that of the emulator.
  • Try to set a longer waiting time for launch.
  • Increase AVD heap and SD card

  • Maybe, it would be good to try to recall all the changes that were done before the problem appeared?

  • Oh! One more: Don't you have by accident simultaneously launched emulator and connected device? If you have the same application (ssame name) on both, they could conflict in a similar way! They simply won't let each other to be launched

If nothing helps:
I was already so tired of Eclipse errors, that I have installed the IntelliJ Idea IDE, too. Now, if for the same project applications behave idself differently on both IDES, the problem is in IDE setting or emulator. If the problem is the same on both, I look for a bug in my application or the external device. Once I had a problem in OS - had to restart Linux. But in your case it is the most probable, that the problem is in AVD. I am afraid, the only variant you haven't try yet is to reinstall Eclipse. Uninstall, remove everything from the application except code, layouts and Manifest, and install Eclipse anew. Or make other Eclipse installation, with its own workshop. You can try the last version. But if the problem is in some setting, you can set it again...

Sorry, I have put here all methods I used or found.

Community
  • 1
  • 1
Gangnus
  • 24,044
  • 16
  • 90
  • 149
  • the path is set correctly. Increased the heap size & sd card support too. Launch time set to 10000. issue still persisting – Lavanya Feb 08 '12 at 14:08
  • I was already so tired of Eclipse errors, that I have installed the IntelliJ Idea IDE, too. Now, if for the same project applications behave idself differently on both IDES, the problem is in IDE setting or emulator. If the problem is the same on both, I look for a bug in my application or the external device. Once I had a problem in OS - had to restart Linux. But in your case it is the most probable, that the problem is in AVD. I am afraid, the only variant you haven't try yet is to reinstall Eclipse. cont'd – Gangnus Feb 08 '12 at 14:32
  • Uninstall, remove everything from the application except code, layouts and Manifest, and install Eclipse anew. Or make other Eclipse installation, with its own workshop. You can try the last version. But if the problem is in some setting, you can set it again... Sorry, I have put here all methods I used or found. – Gangnus Feb 08 '12 at 14:34
  • Maybe, you'll put down what have you done before the problem appeared? – Gangnus Feb 08 '12 at 14:35
  • Oh! One more: Don't you have by accident simultaneously launched emulator and connected device? If you have the same application (ssame name) on both, they could conflict in a similar way! They simply won't let the other to be launched – Gangnus Feb 08 '12 at 14:37
  • I have found an interesting info. Look at this post http://stackoverflow.com/a/5154636/715269. Check, if you do not run the emulator from a snapshot? – Gangnus Feb 18 '12 at 22:31
1

Have you defined all of your Activities correctly and completely in AndroidManifest.xml?

Can you paste the definition of your AndroidManifest.xml here?

Try that.

Bob
  • 22,810
  • 38
  • 143
  • 225
  • If activity is not defined in the manifest, you have error on activity launch, it is much later than the installation of the APK. – Gangnus Feb 09 '12 at 13:51
0

here you can find a similar problem and the proposed accepted solution:

Honeycomb preview - can not install my app on emulator under Eclipse

I hope this helps.

Community
  • 1
  • 1
Maurizio Benedetti
  • 3,557
  • 19
  • 26
0

try cleaning your project or deleting the .APK file in the bin directory of your project.

Lavanya
  • 3,903
  • 6
  • 31
  • 57
Raykud
  • 2,488
  • 3
  • 21
  • 41
0

This could be due to Antivirus/Firewall software installed on your PC. Have you tried to disable it?

You should also ensure that versions of Eclipse, ADT and Android SDK are up-to-date and compatible. Have you tried to contact update sites in Eclipse and in Android SDK manager? By the way, what versions of the that software do you use?

a.ch.
  • 8,285
  • 5
  • 40
  • 53
  • yes. ADT and Android SDK are up-to-date. Eclipse I didnt update. I am not sure about which version is installed in my office pc. – Lavanya Feb 06 '12 at 12:03
0

Let's go step by step.....

1º- You should try to start the emulator without the application installed. 2º- Once it is running correctly, try to install another .apk(like for example one default one....) 3º- Now, try to run the .apk. If the problem continues, try to delete the current VM and install another new one.

zapotec
  • 2,628
  • 4
  • 31
  • 53
0

Can you see Emulator in "adb devices"? If yes, can you install any .apk?

If not - you have propablly something wrong with sdk

  • So, this is strange... Also my emulator have a lot of problems - at this moment Ice Cream Sandwich dont work, Honeycombs runs but apps wont install... :/ – Damian Piwowarski Feb 07 '12 at 18:14
0

As some people have answered already partly. Make sure of a couple things which are very important specially because of the latest Android tools releases which requires.

  1. The latest eclipse version. Yes, very very important: http://www.eclipse.org/downloads/packages/eclipse-classic-371/indigosr1

  2. Make sure you update the Android ADT plugin for eclipse: http://developer.android.com/sdk/eclipse-adt.html#installing

I've encountered similar issue and that was what has helped. Restart your computer too possible?...

Jona
  • 13,325
  • 15
  • 86
  • 129
0

Use command prompt to start emulator

emulator.exe -avd google2.2 -scale 0.7 -dns-server 8.8.8.8

it may help you.

Lavanya
  • 3,903
  • 6
  • 31
  • 57
Prashant Mishra
  • 627
  • 5
  • 18