2

I've got 'no resource found that matches the given name' but everything is set up correctly. error: Error: No resource found that matches the given name (at 'text' with value '@string/labReminderClear').


In AndroidManifest.xml:
<application android:label="MyName"
.....


In Strings.xml:
<string name="app_name">MyName</string>
...
<string name="labReminderClear">Clear</string>

What could be wrong?

xaero212
  • 23
  • 5
  • 1
    Show your code - telling us there's an error without showing code which causes it doesn't help anyone solve your problem. – Squonk Jul 09 '12 at 08:18

2 Answers2

1

The project you've mentiond contains errors in strings.xml file. It is connected with % sign used for example in following line (NOTE: there are multiple in that file):

<string name="msgYouHaveASTS">You have %d appointment(s)\n..and %d task(s)</string>

This is due to aapt (Android Asset Packaging Tool) becoming strict and being used for all versions of Android. See detailed explanation in this answer.

If you want to fix the code so that it works correctly, you have to add info about parameters positions. For example line from above should become:

<string name="msgYouHaveASTS">You have %1$d appointment(s)\n..and %2$d task(s)</string>
Community
  • 1
  • 1
vArDo
  • 4,408
  • 1
  • 17
  • 26
  • Sure thing! Could you provide more links about aapt (parameter positions)? – xaero212 Jul 14 '12 at 12:20
  • @xaero212 Thanks. Info about parameter's position in string (used by formatters) can be found [here](http://developer.android.com/guide/topics/resources/string-resource.html#FormattingAndStyling) (take a look at *"Formatting strings"* subparagraph). As of AAPT itself I don't think you'll need to use it directly. Read about [build proccess](http://developer.android.com/tools/building/index.html#detailed-build) to get info about where AAPT is used. – vArDo Jul 14 '12 at 13:17
  • Thank you again. Możesz dac jakiś kontakt do siebie? ;) – xaero212 Jul 16 '12 at 07:54
  • Could you provide any contact info? – xaero212 Jul 16 '12 at 08:40
  • @xaero212 Sorry, but I'd rather not. I want my SO profile to stay disconnected from other activities (at least for now). – vArDo Jul 16 '12 at 11:35
  • Ok cool. The important thing is you help a lot ;) I wanted your contact info to ask for any beginngers' tutorials to write an app such like AnCal (reminders + tasks with database sync). – xaero212 Jul 17 '12 at 07:54
0

If you're using Eclipse try using (from menus above):

  1. Project->Clean....
  2. Select project, in which you have problem, to be rebuilt.

If that doesn't help Error Log view might help you nail what is the real issue here. From Eclipse menus choose:

Window->Show view->ErrorLog

vArDo
  • 4,408
  • 1
  • 17
  • 26
  • Is there something in `ErrorLog` view? – vArDo Jul 09 '12 at 08:13
  • for example this: Plug-in "org.eclipse.mylyn.bugzilla.ui" was unable to instantiate class "org.eclipse.mylyn.internal.bugzilla.ui.tasklist.BugzillaConnectorUi". – xaero212 Jul 09 '12 at 08:17
  • Also it would be useful to see how you want to use the string. For example in your excerpt from `AndroidManifest.xml` no defined string value is used. Instead string is directly put as value, it should be `android:label="@string/app_name"`. Are you trying to use the string value in XML or in code? – vArDo Jul 09 '12 at 08:17
  • Does that mean I'm missing some plugins? – xaero212 Jul 09 '12 at 08:18
  • it's generally this app from here: http://code.google.com/p/ancal/source/browse/. It's open source. – xaero212 Jul 09 '12 at 08:19
  • @xaero212 this doesn't seem to be related. Anything else? Try building project once again with this panel opened. Also, as I've mentioned in another comment, please **include how you want to use the string value** of `@string/labReminderClear` – vArDo Jul 09 '12 at 08:20
  • @xaero212 What is the exact position of that error in this open source project? – vArDo Jul 09 '12 at 08:26
  • and the error is: error: Error: No resource found that matches the given name (at 'text' with value '@string/labReminderClear'). But there is the resource defined in strings.xml. – xaero212 Jul 09 '12 at 08:27
  • @xaero212 See my other answer - should help :) – vArDo Jul 09 '12 at 08:48
  • @xaero212 Did my other answer helped you? – vArDo Jul 11 '12 at 20:57
  • I will check this later today or tomorrow, don't have access to my Eclipse now. Many many thanks for your help man! – xaero212 Jul 12 '12 at 09:53