22

I am trying to open an unzipped Android Project using Eclipse but every time I try to run or debug it show this error: "selection cannot be launched and there are no recent launches".

So I looked it up and tried creating a new project from an existing source but opens with errors and I open the src etc folders. I also tried importing the project which didn't work either. There are no run as options and changing the run configuration didn't really help. I couldn't find any option to open it as an Android project.

Could you please help me to run this project.

(Since I unzipped this project there is a _MACOSX folder when I import and I am not sure if that matters or should I remove that folder.)

6 Answers6

16

I am running Eclipse Juno SR 2

I had a similar problem. To fix the issue go to Run-> Run Configurations...

  • If there isn't create a new run configuration (top left)
  • Under Android tab: browse and select the project you want to run
  • Under Target tab: select Always prompt to pick device (or) you can pick automatic launch.

Similar solution can be applied to the Debug by going to Run-> Debug Configurations...


Update:

I realize this is beyond the scope of the question but if any new developers are coming to answer then I would suggest switching to Android Studio from Eclipse. AS is the official Google supported IDE for Android development and much nicer to use.

toidiu
  • 965
  • 2
  • 12
  • 25
  • Android Studio is too slow on my laptop running Windows 7 (processor Core i3 and RAM is 3GB) – Solace May 28 '15 at 16:39
  • Thats more than enough memory to run Studio. Here is a way to increase the memory. http://tools.android.com/tech-docs/configuration Also you can see how much memory is allocated to Studio by enabling the indicator(search memory in preferences). https://www.jetbrains.com/idea/help/status-bar.html – toidiu May 29 '15 at 17:39
  • Also note that Studio currently leaks memory when you view xml files(atleast on mac). You can see that the heap size grow and if you dont restart the program becomes un-responsive. I recommend allocating atleast 2GB memory.. This does mean you wont necessarily be able to run anything else on a 3GB computer.. – toidiu May 29 '15 at 17:48
4

In the Package Explorer (the left column), right-click on the name of the project (the top item). In the menu that appears, select "Run as"; then choose "Android Application".

1

I fixed it for Version: Luna SR2 (4.4.2)

  1. select run configurations from right side dropdown of run button.
  2. double click on android application.
  3. get changing window, select your project name by browsing button of "android" tap(there are 3 tabs).
  4. from "target" tab select ADT or your device, in which you want to run.
  5. then press "run" at right -bottom button, left-side of "cancel".
  6. after few moment, you will get new windows. from there you can select your connected device or ADT.
reza.cse08
  • 5,938
  • 48
  • 39
0

Generally this error comes in eclipse IDE when you don't have a main() function in your code.

Check whether your program has public static void main(String [] args) in it or not.

0

I'm using a mac and this answer is for Kotlin inside Eclipse

I installed Kotlin from Eclipse MarketPlace, clicked the perspective tab enter image description here, opened Kotlin, created a new Kotlin project named FirstProject and then clicked src and created a Kotlin file named FirstFile (it had the .kt extension) and typed in

func main(args : Array<String>) {

    println("Helooooooo")
}

I pressed the green Run button enter image description here but kept getting this screen.

enter image description here

To fix it, follow these steps:

  1. Right next to that green run button is a drop down arrow, press it then choose Run Configurations

enter image description here

  1. On the left side of the accompanying screen click Kotlin Script Launch Configuration and in the drop down click New_configuration then select Run

enter image description here

  1. After the screen disappeared when I pressed the Run button again I got the same exact "This selection cannot be launched ..." screen. I deleted the project FirstProject and created another one SecondProject > src > Kotlin file > named it SecondFile, typed in the println("Heloooooooo") code and a screen popped up

enter image description here

  1. I choose OK and the project ran fine.

For steps 1 & 2 I also did the same thing and choose Gradle (you can see it the picture) but I don't think that made any difference.

Lance Samaria
  • 17,576
  • 18
  • 108
  • 256
0

If this file is and .apk, you should install it on emulator using following command:

adb install /path/myfile.apk  

For more informations, you can chek following link: http://developer.android.com/guide/developing/tools/adb.html#move

Pascal MARTIN
  • 395,085
  • 80
  • 655
  • 663
Sandip Armal Patil
  • 6,241
  • 21
  • 93
  • 160