2011-01-19 24 views
24

這符合:沒有資源發現在給定的名字

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

    <uses-sdk android:minSdkVersion="7"></uses-sdk> 
<application android:icon="@drawable/icon" android:label="@string/app_name" 
android:theme="@android:style/Theme.Light"> 

    <activity android:name=".FormularActivity" 
     android:label="@string/app_name"> 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 
      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 

是我AndroidManifest.xml和線8 & 11我得到的錯誤:

no resource found that matches the given name(at "label" with value "@string/app_name")

no resource found that matches the given name(at "label" with value "@string/app_name")

這是真的奇怪,我沒有移動值文件夾的任何地方。

回答

38

您是否檢查並確保您已在res/values/strings.xml中定義字符串資源?

<string name="app_name">"My App"</string> 

有時,我注意到eclipse也會拋出錯誤,如果你有錯誤的任何.xml文件,很難追蹤。我認爲解析器不能很好地恢復,有時你得到的錯誤可能會引起誤解。

+1

哦,我有時候我很愚蠢!非常感謝!該文件甚至不存在於我的程序:) – sam 2011-01-19 14:56:57

+0

此文件在我的項目中也不存在。你能提供更多的細節如何解決這個錯誤?我創建了strings.xml並將其放在上面的代碼行中,可悲的是它本身給我一個錯誤。還有更多要添加到此文件嗎? – ProblemsOfSumit 2013-08-26 10:36:29

-5

我遇到了同樣的問題。刪除"@string"android:label="@string/app_name",它會正常工作。

android:label="@string/app_name" -> android:label="app_name" 
1

一個原因可能是因爲在我的情況下,字符串GUI在當你添加在一些序列中刪除項目中的錯誤

解決: 只需在XML打開strings.xml模式不是圖形用戶界面你會發現它不同,並有明顯無效的附加文本粘貼在周圍或開始;雖然它不會給文件上的錯誤strings.xml修復它們,然後清理並運行

1

我也有與我的圖像相同的錯誤..只需重命名擴展名「.png」或任何你必須「.jpg 「那麼在清理完項目並重新編譯之後,它們可以正常工作。

相關問題