I have downloaded code from google codes but when I import that project in my eclipse IDE it does not generate R.Java file.I searched many blogs and forums and tried many th
I encountered the same problem trying to build the wiktionary sample code I downloaded from code.google.com (here) I had imported into a new Eclipse Juno project set to use Android 4.1 and JDK 1.6.
Here is an excerpt of the console after building the project:
W/ResourceType( 6292): Bad XML block: header size 103 or total size 0 is larger than data size 0 C:\Development\WorkJava\android\sampleapps\Wiktionary\com.example.android.wiktionary.LookupActivity\res\values\strings.xml:23: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute? C:\Development\WorkJava\android\sampleapps\Wiktionary\com.example.android.wiktionary.LookupActivity\res\values\strings.xml:23: error: Unexpected end tag string
Here's an excerpt of the res/values/string.xml:
Wiktionary Word of the Day
A fast Wiktionary browser and Word-of-day widget
"All dictionary content provided by Wiktionary under a GFDL license. http://en.wiktionary.org\n\nIcon derived from Tango Desktop Project under a public domain license. http://tango.freedesktop.org".
"%s/%s (Linux; Android)"
"Wiktionary:Word of the day/%s %s"
"Wiktionary:Word_of_the_day/Archive/%s/%s"
SOLUTION
Adding formatted="false" to the 3 last string definitions (containing two %s substitution placeholders), as shown below, solved the problem. Rebuilding the project generated R.java in the gen folder.
Wiktionary Word of the Day
A fast Wiktionary browser and Word-of-day widget
"All dictionary content provided by Wiktionary under a GFDL license. http://en.wiktionary.org\n\nIcon derived from Tango Desktop Project under a public domain license. http://tango.freedesktop.org".
"%s/%s (Linux; Android)"
"Wiktionary:Word of the day/%s %s"
"Wiktionary:Word_of_the_day/Archive/%s/%s"