2

每次我编译我的android代码时,我都会收到这个错误。

[2012-09-30 14:46:48 - My First App] activity_main.out.xml is out of sync. Please refresh.
[2012-09-30 14:47:08 - My First App] activity_main.out.xml is out of sync. Please refresh.
[2012-09-30 14:51:04 - My First App] Error in an XML file: aborting build.
[2012-09-30 14:51:18 - My First App] Error in an XML file: aborting build.
[2012-09-30 15:39:17 - My First App] Error in an XML file: aborting build.
[2012-09-30 21:21:33 - sup_cheesepuff] ------------------------------
[2012-09-30 21:21:33 - sup_cheesepuff] Android Launch!
[2012-09-30 21:21:33 - sup_cheesepuff] adb is running normally.
[2012-09-30 21:21:33 - sup_cheesepuff] Performing com.example.sup_cheesepuff.MainActivity activity launch
[2012-09-30 21:21:34 - sup_cheesepuff] Automatic Target Mode: launching new emulator with compatible AVD 'Froyo.'
[2012-09-30 21:21:34 - sup_cheesepuff] Launching a new emulator with Virtual Device 'Froyo.'
[2012-09-30 21:21:56 - Emulator] 2012-09-30 21:21:56.633 emulator-arm[7523:1107] Warning once: This application, or a library it uses, is using NSQuickDrawView, which has been deprecated. Apps should cease use of QuickDraw and move to Quartz.
[2012-09-30 21:21:56 - sup_cheesepuff] New emulator found: emulator-5554
[2012-09-30 21:21:56 - sup_cheesepuff] Waiting for HOME ('android.process.acore') to be launched...
[2012-09-30 21:23:20 - sup_cheesepuff] HOME is up on device 'emulator-5554'
[2012-09-30 21:23:20 - sup_cheesepuff] Uploading sup_cheesepuff.apk onto device 'emulator-5554'
[2012-09-30 21:23:20 - sup_cheesepuff] Installing sup_cheesepuff.apk...
[2012-09-30 21:23:36 - sup_cheesepuff] Success!
[2012-09-30 21:23:36 - sup_cheesepuff] Starting activity com.example.sup_cheesepuff.MainActivity on device emulator-5554
[2012-09-30 21:23:41 - sup_cheesepuff] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.sup_cheesepuff/.MainActivity }
[2012-09-30 21:32:10 - sup_cheesepuff] Error in an XML file: aborting build.

我已经查看了具有类似主题的其他主题,但没有任何帮助。这是我的 XML 源代码。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:text="@string/hello_world"
        tools:context=".MainActivity" />

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="100dp"
        android:text="Hey boi!"
        android:textAppearance="?android:attr/textAppearanceLarge" />

</RelativeLayout>

顺便说一句,我对 Android 和 XML 都是新手。

4

2 回答 2

8

当您在编辑 XML 文件时尝试从 Eclipse 执行应用程序时会发生这种情况。它尝试编译 XML 文件,但惨遭失败,生成 .out.xml 文件。

这是一个简单的修复,只需删除有问题的 .out.xml 文件,并确保在编译时正在编辑 .java 文件(或者您可以在构建配置中设置目标)。

编辑:哦,欢迎来到 StackOverflow!

于 2012-10-02T01:26:14.263 回答
2

当您尝试从XML文件编译项目时会出现此问题!您可以从您的java文件编译,也可以通过以下方式从任何位置编译:org.eclipse.wst.xsl.*从文件夹中删除所有实例,"\Eclipse\plugins"并在重新启动 Eclipse 后,一切都将按预期工作。尝试一下!

于 2012-10-02T01:56:22.903 回答