"Selection cannot be launched and there are no recent launches” when Eclipse for Android Project Dev-ThrowExceptions

Exception or error:

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.)

How to solve:

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.

###

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”.

###

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.

###

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

###

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.

###

Just select the whole code and run the code, it may work. If this doesn’t work try the above solution.

###

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.

Leave a Reply

Your email address will not be published. Required fields are marked *