18

I've been programming Android in Eclipse for about a year now and I have always launched my app by right clicking on my project name in the project explorer, followed by "run as", then "Android Application". There has to be a better way...

Is there a way to change this (three mouse clicks):

"Right click on project" -> "run as" -> "Android Application"

To this (one hotkey press):

<My favorite hotkey>

So I can just press one button to launch my app?

Thanks!

Bruiser
  • 11,767
  • 5
  • 34
  • 45
Brad Hein
  • 10,997
  • 12
  • 51
  • 74

8 Answers8

28
  1. Eclipse/Window > Preferences > Run/Debug > Launching
  2. Select 'Always launch the previously launched application' in the 'Launch Operation' section.
  3. Then just use your shortcut of choice. I think Ctrl + F11 is the default for this
Bruiser
  • 11,767
  • 5
  • 34
  • 45
7

In preferences, go to General -> keys and search for the Android Application command. You can set a new key combination from here.

krock
  • 28,904
  • 13
  • 79
  • 85
  • 1
    I bound CTRL+F11 to "Run android application" for "in windows" and it doesn't do sh** when I press the key. Any ideas? – Brad Hein Aug 07 '10 at 14:40
  • Check the conflicts list, if another key combination is bound to CTRL+F11 already then you will need to change it to something else. [This question](http://stackoverflow.com/questions/1151995) mentions that CTRL+F11 is mapped to something else. – krock Aug 07 '10 at 14:51
  • I tried a few different other keys with no conflicts, none worked. I have a suspicion that the Gnome window manager is intercepting my key sequences. I did try a really wacky one Control+shift+F10 which definitely wasn't bound in Gnome and it still failed. – Brad Hein Aug 07 '10 at 17:09
  • Accepting this answer. This is indeed how keyboard shortcuts are set in Eclipse. The reason it's not working on my PC is something with my desktop configuration so no sense in keeping this question open any longer. Thank you! – Brad Hein Aug 16 '10 at 05:04
  • I think the reason this might be confusing, is that you have to be editing a Java file, it doesn't work with XML files. It is an important nuance (and often overlooked). – Booger Jun 06 '13 at 02:22
3

On MacOSX, for me worked Cmd+Shift+F11, which came down on laptop keyboard to Cmd+fn+Shift+F11

DaveShaw
  • 52,123
  • 16
  • 112
  • 141
Geert Weening
  • 1,480
  • 1
  • 13
  • 17
1

I am not sure why the last answer is voted down, as I think it is the best answer. In the standard ADT Eclipse tool bar, there is the following button: enter image description here

If you are editing a Java file, and press this button, your app will automatically be launched. Thus, this is one the one button press to launch your app.

As with the other shortcuts mentioned here, this does not work if you are editing an XML file (so ensure your editor is showing a Java file).

Booger
  • 18,579
  • 7
  • 55
  • 72
1

1) Eclipse/Window > Preferences > Run/Debug > Launching

2) Select 'Always launch the previously launched application' in the 'Launch Operation' section.

3) Then just use your shortcut of choice. I think Ctrl + F11 is the default for this

Someone suggested the above and it worked for me!

muneebahmad
  • 119
  • 1
  • 3
0

If you want to run your app when a XML file is open in your eclipse you must set your run configuration Eclipse -> run -> run configuration -> Android Application in left window -> your configuration -> android tab in right window -> launch -> select your main activity

Amir
  • 652
  • 9
  • 19
0

For this you can use (ctrl+F11) , which shows all online devices which is used as emulator

-2

Eclipse toolbar has green run button which has default meaning run last selected configuration. Just click there.

Jaakl
  • 25