score:66

Accepted answer

I had same problem,then(as Jeff Schultz said here) I tried:

Run As -> Android Application

and problem solved.But I don't know the reason that causes this problem.I hope this help you!

score:0

Same thing happened to me. I created a TestActivity and I guess it had a public static void main(String args[]) function. I went into the properties and then the Run/Debug and deleted TestActivity and it worked just fine.

score:0

I had a similar problem on the fatal error: Invalid layout of preloaded class with Kepler Service Release 1 using windows 7.

Project -> Properties -> Java Build Path -> Order and Export --> check mark any 
unchecked library or Android version and then hit OK. Then run as Android application.

score:0

I had the same problem, solved it by:

Run->Run Configurations;

Click on left on "Android Application"-> Button on top "New";

then type in a name and "Browse" the Project -> works!

score:1

You should make a run configuration for an "Android application". If you make it for "Java Application" by mistake this error will show.

score:4

This happened to me after:

  1. Inserting a class in the Android Application project where I had forgotten to remove public static void main(String args[]) function. (Had previously performed a quick test of the class).
  2. Tried to run the Application while I had opened and focused the above class on Eclipse editor.

The funny thing was that, after the Eclipse error, no matter on what class I switched the focus on, when I was trying to run the application again, I was stuck with the same error.

Inspired by Odyr Sohn solution, I managed to solve the problem (from Project->Properties->Run/Debug Settings deleting the faulty Launch configuration), but as soon as I was trying to run the application from this class, the same thing was happening again. When I removed public static void main(String args[]) function from the class, the problem was solved for good.

score:118

In case of an Android project, you have to remove Android Lib from the launch configuration for that specific class. Use the "walkthrough" below as a guide.

  • Project->Properties->Run/Debug Settings;
  • Select your Class and click "Edit";
  • Open the tab "Classpath" and remove Android Lib from "Bootstrap Entries";
  • Apply everything and Run the class again.

Related Query

More Query from same tag