0

I am learning Android development through the training given on developer.android.com and I have done till "Starting Another Activity". When I tried to run my code, I get the following error in AndroidManifest.xml :

error: Error Parsing XML: XML or text declaration not at start of entity

I suppose I have not edited a line on AndroidManifest.xml as I am using eclipse IDE and did not need to create the labels myself. Here is my AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myfirstapp"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="17" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.example.myfirstapp.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.example.myfirstapp.DisplayMessageActivity"
        android:label="@string/title_activity_display_message"
        android:parentActivityName="com.example.myfirstapp.MainActivity" >
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value="com.example.myfirstapp.MainActivity" />
    </activity>
</application>

</manifest>

The error is showing in the first line of code. Please help.

4

2 回答 2

3

您的项目未正确刷新,这就是显示错误的原因

在日食Project-->Clean位置

然后只需清理并构建您的项目。

于 2013-01-19T07:27:26.230 回答
0

错误可能是因为你的布局文件

完成 XML 中的每个标记

像这样

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:orientation="vertical">

 <TextView android:id="@+id/text1"
     android:textSize="16sp"
     android:textStyle="bold"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"/>

 <TextView android:id="@+id/text2"
     android:textSize="16sp"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"/>
 </LinearLayout>
于 2013-01-19T07:30:06.520 回答