0

I am trying to create my first Android app. I am using Eclipse. I create a project, and before I add any code myself, I run the default project, and I get the 'Hello, MyApp' in my emulator.

All good.

I then drag and drop a button onto my 'avtivity', under the text that was added when I create the project.

Suddenly, XML errors!

[2012-06-02 18:03:48 - FuelLogger] res\layout\main.xml:0: error: Resource entry main is already defined.
[2012-06-02 18:03:48 - FuelLogger] res\layout\main.out.xml:0: Originally defined here.
[2012-06-02 18:03:48 - FuelLogger] D:\Android\eclipse\Workspace\res\layout\main.out.xml:1: error: Error parsing XML: no element found
[2012-06-02 18:03:49 - FuelLogger] Error in an XML file: aborting build.

It has created a new files, main.out.xml

What's that? It's empty.

My main.xml looks like this:

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" />

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button" />

</LinearLayout>

If I look at the 'Graphical Layout' tab, it looks fine...

I am obviously missing something here. Hope someone can help.

Craig
  • 18,074
  • 38
  • 147
  • 248

4 Answers4

2

I think you have selected your main.xml and is oped in code window; then you r pressing RUN button of eclipse. Which creates error.

First of All: DELETE : main.out.xml From your res\layout\ folder Then

To run project:

Make open "Project Explorer"

Rigth Click on Your Project,

Click Run AS

Click Android Application

Chintan Raghwani
  • 3,370
  • 4
  • 22
  • 33
1

Delete the main.xml.out file from your res/layout folder and the clean and build/run the application. If you are not able to delete the file from eclipse delete it from your workspace and the clean and build/run the application

Shankar Agarwal
  • 34,573
  • 7
  • 66
  • 64
1

Delete main.out.xml, and run as Android application after cleaning. Here is detailed description Similar problem answers: main-out-xml-parsing-error

Community
  • 1
  • 1
Imran Rana
  • 11,899
  • 7
  • 45
  • 51
0

also you might want to look here. Seems related to your question, that main.out.xml is what's causing the trouble...

Community
  • 1
  • 1