2015-08-14 165 views
0

所以我無法執行該項目由於此錯誤。現在,我嘗試了以下在這裏看到的技術: - 重建並清理了項目 - 重新開始的Android Studio - 創建新項目並讀取文件,在添加每個主要文件後運行項目。AndroidStudio-無法運行項目,因爲「無法解析符號R」

現在,第三個問題給了我一些線索。當我添加了一個片段,並把一些代碼並運行項目,我得到了以下2個錯誤:

錯誤:(1)錯誤解析XML:執行失敗:XML格式不正確

錯誤申報任務':app:processDebugResources'。

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Temp\AppData\Local\Android\sdk\build-tools\22.0.1\aapt.exe'' finished with non-zero exit value 1

當我打開控制檯的gradle我看到以下內容:

失敗:建立失敗,一個例外。

  • 出了什麼問題: 執行失敗的任務 ':應用程序:processDebugResources'。

    com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Temp\AppData\Local\Android\sdk\build-tools\22.0.1\aapt.exe'' finished with non-zero exit value 1

  • 嘗試: 與--stacktrace選項獲取堆棧跟蹤運行。使用--info或--debug選項運行以獲取更多日誌輸出。

我是一名初學者程序員,所以我不太確定該怎麼做。

任何幫助將不勝感激。我重視從下面的fragment.xlm代碼:

<?xml verion="1.0" encoding="UTF-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical"> 

    <TextView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:textAppearance="?android:attr/textAppearanceLarge" 
    android:id="@+id/textTitle" 
    android:text="" /> 


    <TextView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="" 
    android:id="@+id/textDescription" /> 

</LinearLayout> 

回答

3

「錯誤解析XML:沒有良好的XML聲明」意味着在編譯你的XML文件,出了問題,如不正確的命名空間,以及額外的/流浪角色,丟失或錯位的關閉或打開標籤,或其他拼寫錯誤。

你的情況在第一行有拼寫錯誤。

<?xml verion="1.0" encoding="UTF-8"?> 

應該是:

<?xml version="1.0" encoding="UTF-8"?> 
+0

三江源這麼多,就是這樣一個愚蠢的錯誤,對不起:( – Frosty619

+0

不客氣我們已經這樣做所有的錯誤在一個點或另一個,所以不用擔心。 – joshgoldeneagle