错误:找不到与给定名称匹配的资源(在'title'处,值为'@ string/menu_settings')

use*_*805 5 java eclipse string android

我正在从"hello to android"一书中练习"数独".我看到有些人和我有同样的问题,但我无法解决.我已经删除了三次这个项目,并从头开始重新创建,但我在下面仍然收到相同的错误消息,即使我正在从书中复制/粘贴.

W/ResourceType( 8592): Bad XML block: header size 29806 or total size 538970658 is larger than data size 0
    C:\java\Sudoku\res\layout\activity_main.xml:6: error: Error: No resource found that matches the given name (at 'text' with value '@string/hello_world').
C:\java\Sudoku\res\menu\activity_main.xml:2: error: Error: No resource found that matches the given name (at 'title' with value '@string/menu_settings').
Run Code Online (Sandbox Code Playgroud)

书中有代码Sudokuv1/res/layout/main1.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/main_title" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/continue_label" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/new_game_label" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/about_label" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/exit_label" />
</LinearLayout>    
Run Code Online (Sandbox Code Playgroud)

有以下代码Sudokuv1/res/values/strings.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Sudoku</string>
<string name="main_title">Android Sudoku</string>
<string name="continue_label">Continue</string>
<string name="new_game_label">New Game</string>
<string name="about_label">About</string>
<string name="exit_label">Exit</string>
</resources>
Run Code Online (Sandbox Code Playgroud)

谢谢您的帮助!

小智 3

如果您使用 Elcipse 插件创建了 Android 应用程序,则在该res文件夹中您有一个 menu 文件夹,并且该文件夹内还有另一个activity_mail.xml.

删除该文件或注释其内容,因为您不会使用sudoku app.

那应该解决它。