9

Is there a way to force Eclipse to restart an Android app that has not changed, even if it has to be re-downloaded and reinstalled?

I am in a situation where I'm running an Android app that does stuff on startup that I need to repeat for debugging purposes.

What I would like to do is click the "Run" button in Eclipse and have it force restart my app each time. But instead, Eclipse/Android tries to be smart and it just brings my app to the front without restarting. I get a message in the console:

ActivityManager: Warning: Activity not started, its current task has been brought to the front

The only workaround I have found is to make dummy text changes to force a recompile/re-install. But that's kind of annoying, especially with the code under revision control.

jfritz42
  • 5,913
  • 5
  • 50
  • 66
  • did you try to uninstall the application from the emulator and run again ? – prakashkut Aug 02 '11 at 20:04
  • @PrakashkumarThiagarajan I'm hoping to do this in one-click, see other comments. Uninstalling an app is rather painful and I need to start/restart the app frequently. – jfritz42 Aug 03 '11 at 22:50

3 Answers3

6

The lazy work is to put a space char , save it, delete the char, save it and rebuild. As i said the lazy (fast) work..

weakwire
  • 9,284
  • 8
  • 53
  • 78
6

Besides already mentioned meaningless chars and stopping from device menu, you can also stop your application process from DDMS perspective, Devices View -> Name of your process -> push red button.

Nikolay Ivanov
  • 8,897
  • 3
  • 31
  • 34
  • OK. Too bad that still requires several clicks. I was hoping for the ideal, one-click solution of hitting the "Run" button in Eclipse and having it do what I want. Maybe somebody knows how to suggest changes to Eclipse? (or maybe this is an Android plugin issue) – jfritz42 Aug 03 '11 at 22:48
  • @jfritz42 Ideal solution will be to add such option to run configuration of an android app, but, at least for now, there no such option – Nikolay Ivanov Aug 04 '11 at 06:01
  • It's been a long time since I used Eclipse but maybe you could hook up a keystroke or a script or similar to use instead of that Build and go button. – Jonny Nov 05 '12 at 10:08
1

Kill the app from the running tasks either on the emulator or on the device you are debugging on.

  • Settings --> Applications --> Manage Applications --> Your app Name --> Force Stop (or even uninstall) – zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz Aug 02 '11 at 20:02
  • I guess my goal is to minimize clicks. The ideal, one-click solution is just to hit the "Run" button in Eclipse, but that doesn't work. It seems the next easiest solution is the standard "hit space, delete, save, run" – jfritz42 Aug 03 '11 at 22:46
  • Outside of Android I don't use eclipse much but I'm sure you could script something similar to run every time you hit the run button if you are really looking to minimize clicks. – zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz Aug 04 '11 at 13:40