Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error parsing XML: no element found

First off forgive me if I posted this question wrong. I've used stackoverflow for many problems but this is the first time I couldnt already find an answer to my problem. So, if I'm doing something wrong please let me know and I'll repost / edit the question.

Now unto business. I've just recently started development w/ the Android SDK and I'm following the basic tutorial from http://developer.android.com/resources/tutorials/hello-world.html#avd I've gotten up the xml editting part and when I make all the changes to the xml files main.xml and strings.xml this error occurs. Also, when I compile the project, the compilation process generates a main.out.xml file that is empty. I don't know what it is or its purpose.

The error:

[2011-12-30 16:10:02 - Hello Razor] res\layout\main.xml:0: error: Resource entry main is already defined. [2011-12-30 16:10:02 - Hello Razor] res\layout\main.out.xml:0: Originally defined here. [2011-12-30 16:10:02 - Hello Razor] C:\Users\Dux69\workspace\Hello Razor\res\layout\main.out.xml:1: error: Error parsing XML: no element found [2011-12-30 16:10:13 - Hello Razor] Error in an XML file: aborting build.

My project is setup for platform: Android 2.3.3 API Level: 10

I don't know if it makes a difference or not but I'm using my Android Incredible for running/debugging the application not a Android Virtual Device. If there is any more information needed let me know and I'll post it ASAP.

Here are the three code files I'm using:

main.xml

<?xml version="1.0" encoding="utf-8"?>
<TextView  xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/textview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" 
android:text="@string/hello_O" />

strings.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello_O">Baba in the house, Razor Activity!</string>
<string name="app_name">Hello Razor App</string>
</resources>

razorActivity.java

package hello.Razor;

import android.R;
import android.app.Activity;
import android.os.Bundle;

    public class razorActivity extends Activity
    {
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState)
        {
           super.onCreate(savedInstanceState);
           setContentView(R.layout.main);
        }
    }
like image 866
DuxClarus Avatar asked Dec 30 '11 23:12

DuxClarus


People also ask

What is a XML parsing error?

Several users report dealing with the XML Parsing Error whenever they try to open a Microsoft Word document that they previously exported. The issue typically occurs after the user has upgraded to a newer Office version or after if the Word document was previously exported from a different program.

What is parsing XML?

Definition. XML parsing is the process of reading an XML document and providing an interface to the user application for accessing the document. An XML parser is a software apparatus that accomplishes such tasks.


4 Answers

Try to end your Main or Sub Layout like:

</LinearLayout>
like image 139
Maizied Hasan Shuvo Avatar answered Oct 22 '22 14:10

Maizied Hasan Shuvo


I had a similar problem once.

Rebuilding/cleaning the project and restarting Eclipse helped for me.

like image 40
user1014917 Avatar answered Oct 22 '22 15:10

user1014917


delete the main.out.xml in project view and re-run as android application

like image 42
Riccardo Bocci Avatar answered Oct 22 '22 13:10

Riccardo Bocci


Error message I got:

Error:(43) Error parsing XML: no element found

and

Error:Execution failed for task ':app:processDebugResources'.

com.android.ide.common.process.ProcessException: Failed to execute aapt

Solution: In my case, project activity_main.xml is initiated with the code

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.batvibes.battybirthday.Main1Activity">

and I forgot the below end tag.

</android.support.constraint.ConstraintLayout>

Disclaimer: I am totally new to android development. My suggestion, please check all tags opening and closing and go to next step of debugging.

like image 42
nerd007 Avatar answered Oct 22 '22 13:10

nerd007