Sto facendo l'esercizio "sudoku" dal libro "ciao ad android". Ho visto che alcune persone hanno lo stesso problema di me ma non sono in grado di risolverlo. Ho cancellato tre volte questo progetto e ricreato dall'inizio, ma continuo a ricevere lo stesso messaggio di errore in basso, anche se sto facendo una copia/incolla dal libro.Errore: Nessuna risorsa trovata che corrisponde al nome dato (a 'titolo' con valore '@ string/menu_settings')
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').
C'è il codice all'interno del libro per il 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>
C'è il codice per 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>
Grazie per il vostro aiuto!
Penso che il problema sia nel xml activity_main non quello che hai postato, sembra che stia cercando una stringa chiamata hello_world e menu_settings che non esistono. – MikeIsrael
Hai incollato l'xml sbagliato. Controlla l'output dell'errore. –
mostraci activity_main.xml .... o semplicemente aggiungilo a string.xml ciao e questo è tutto. –
Shark