Fatal Error: Invalid Layout of java.lang.String at value

巧了我就是萌 提交于 2019-11-26 18:48:07
hasanghaforian

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!

Odyr Sohn

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

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.

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

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.

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!

Seattle Ninja

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.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!