Error starting an Android program

2019-01-28 22:49发布

问题:

[2010-04-16 23:31:34 - MobileDataKeeper] Error in an XML file: aborting build.
[2010-04-16 23:31:57 - MobileDataKeeper] Error in an XML file: aborting build.
[2010-04-16 23:32:28 - MobileDataKeeper] Error in an XML file: aborting build.
[2010-04-16 23:34:56 - MobileDataKeeper] Error in an XML file: aborting build.
[2010-04-16 23:35:14 - MobileDataKeeper] res/layout/main.out.xml:0: error: Resource entry main is already defined.
[2010-04-16 23:35:14 - MobileDataKeeper] res/layout/main.out.out.xml:0: Originally defined here.
[2010-04-16 23:35:14 - MobileDataKeeper] res/layout/main.xml:0: error: Resource entry main is already defined.
[2010-04-16 23:35:14 - MobileDataKeeper] res/layout/main.out.out.xml:0: Originally defined here.
[2010-04-16 23:35:14 - MobileDataKeeper] /media/Mis Documentos/Dropbox/Eclipse/MobileDataKeeper/res/layout/main.out.out.xml:1: error: Error parsing XML: no element found
[2010-04-16 23:35:14 - MobileDataKeeper] /media/Mis Documentos/Dropbox/Eclipse/MobileDataKeeper/res/layout/main.out.xml:1: error: Error parsing XML: no element found
[2010-04-16 23:35:49 - MobileDataKeeper] Error in an XML file: aborting build.

Main.xml.out.* are empty. The MobileDataKeeper.java is default and the Mainx.xml out is:

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout
    android:id="@+id/RelativeLayout01"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    xmlns:android="http://schemas.android.com/apk/res/android" />

Every time i change something in the Main.xml get this problem. It's very frustrating and I don't know what the heck is going on. A trained eye is requiered!

Thanks!

回答1:

Delete all main.xml.out files in your project. Then, do NOT attempt to run the project with an XML file as the active tab in the editor in Eclipse -- switch to a Java file. It is the attempt to run the project with an XML file as the active tab that creates those .out files and messes up the system.

There's probably a more sophisticated workaround, but I am not an Eclipse user, so I do not know what it is.



回答2:

This was killing me. Heres a fix that does not require you to switch editors:

Eclipse -> Window -> Preferences -> Run/Debug -> Launching -> Launch Operation -> Always Launch the previously launched application

Of course delete the xml out files that were created as suggested, and make sure you have at least run the correct configuration at least once.



回答3:

Delete the main.out.xml, if you still can't run, then follow this:
Eclipse -> Project -> Clean... -> Choose your project -> OK