2012-10-02 51 views
2

每次我编译我的android代码,我得到这个错误。Android .out.xml错误?

[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都很陌生。

+0

等一会儿,然后尝试删除out.xml文件 – Aprian

+1

Patrick,它对comminity非常有用,标记的答案类似于正确的答案 – Aracem

回答

8

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

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

编辑:哦,欢迎来到StackOverflow!

2

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