Craig
Craig

Reputation: 18734

Eclipse help for brand new user

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.

Upvotes: 0

Views: 597

Answers (4)

Imran Rana
Imran Rana

Reputation: 11899

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

Upvotes: 1

user818700
user818700

Reputation:

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

Upvotes: 0

Shankar Agarwal
Shankar Agarwal

Reputation: 34775

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

Upvotes: 1

Chintan Raghwani
Chintan Raghwani

Reputation: 3370

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

Upvotes: 2

Related Questions