2012-07-25 75 views
9

我剛開始一個新的Android項目,HELLOWORD」繼續學習Android開發,我得到難倒編譯默認的‘HELLOWORD’編譯/運行,我想我錯過了配置的步驟並設置,但我不知道在哪裏我有一個配置,設置和啓動AVDAndroid SDK中main.out.xml解析錯誤

當我按'運行',我找不到android2.1 simulator.and找到這些錯誤:

[2012-07-25 08:59:49 - helloword] res\layout\activity_main.xml:0: error: Resource entry activity_main is already defined. 
[2012-07-25 08:59:49 - helloword] res\layout\activity_main.out.xml:0: Originally defined here. 
[2012-07-25 08:59:49 - helloword] E:\android軟件開發\新建文件夾\helloword\res\layout\activity_main.out.xml:1: error: Error parsing XML: no element found 
[2012-07-25 10:03:12 - helloword] /helloword/gen already exists but is not a source folder. Convert to a source folder or rename it. 
[2012-07-25 10:03:13 - helloword] /helloword/gen already exists but is not a source folder. Convert to a source folder or rename it. 
[2012-07-25 10:03:15 - helloword] File is Out of sync 
[2012-07-25 10:05:13 - helloword] /helloword/gen already exists but is not a source folder. Convert to a source folder or rename it. 
[2012-07-25 10:08:44 - helloword] activity_main.out.xml is out of sync. Please refresh. 
[2012-07-25 10:08:45 - helloword] activity_main.out.xml is out of sync. Please refresh. 
+0

你有沒有在窗口 - >首選項的Android項目?你嘗試啓動運行(Ctrl + F11從Java文件,而不是XML)?並且,移除activity_main.out.xml文件 - 這是錯誤的,通常在嘗試從xml文件啓動運行時生成。 – sandrstar 2012-07-25 02:49:07

+0

閱讀本http://code.google.com/p/android/issues/detail?id=3767 – 2012-07-25 03:09:03

回答

27

這不是你的錯。當您嘗試從XML資源編譯Android項目,日食視其爲執行XML文件,所以你從它那裏得到一些輸出,在XML的同名.out.xml擴展。

爲了避免這種情況,你必須右鍵單擊該項目並選擇運行方式 - > Android應用程序首次,然後按照下面的步驟,

窗口 - >首選項 - >運行/調試 - >下水 - >啓動運行 - >始終啓動之前啓動的應用程序

一旦你在窗口 - >首選項提供這一點,從下一次WH恩按「運行」「CTRL + F11」即使從XML文件,您的項目將得到執行。

編輯:還必須刪除RES /佈局/ * out.xml,了Eclipse創建的文件,你不需要它。

+1

超強!修復 – 2013-01-10 20:13:10

0

切勿從XML文件運行項目。開Java代碼然後運行它。如果你從XML運行它,你會得到error.Its也同樣爲manifest文件

2

有同樣的問題,這爲我修好了。

  1. 刪除activity_main.out.xml
  2. 雙擊一個.java文件
  3. 按F11