tags:

views:

1774

answers:

3

Common problem I'm sure, but I can't figure it out. In my AndroidManifest.xml and main.xml I'm getting the no resource found that matches the given name. I've double checked for typos and it used to work, but now I'm popping up with all these errors saying it can't find my strings in my strings.xml.

These are the ones I'm getting errors for in my main.xml.

    <TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="10dip"
    android:text="@string/instructions"    />

    <TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="10dip"
    android:text="@string/level_prompt"    />

    <Spinner         
    android:id="@+id/spinner"        
    android:layout_width="fill_parent"        
    android:layout_height="wrap_content"        
    android:prompt="@string/level_array"    />

These are the ones I'm getting for my androidmanifest.xml.

<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".HelloFormStuff" android:label="@string/title">

This is what my strings.xml looks like.

<string name="title">Title</string>
<string name="app_name">Application name</string>

<string name="instructions">Enter instructions here.</string>

<string name="level_prompt">Choose an item</string>

<string-array name="level_array">        
<item>Item One</item>        
<item>Item Two</item>        
<item>Item Three</item>        
<item>Item Four</item>
</string-array>

Any ideas? Any help would be appreciated!!

A: 

I think the issue is that you have

android:prompt="@string/level_array"

and you don't have any string with the id, to refer to the array, you need to use @array

test this or put a screen of your log please

Sephy
@Sephy,Commented out all code for the array, but it didn't help. It's like the project isn't associating the strings.xml file to it.
KennyH
No resource found that matches the given name (at 'label' with value '@string/app_name'). AndroidManifest.xml /HelloFormStuff line 6 Android AAPT ProblemNo resource found that matches the given name (at 'label' with value '@string/title'). AndroidManifest.xml /HelloFormStuff line 7 Android AAPT ProblemNo resource found that matches the given name (at 'label' with value '@string/title'). AndroidManifest.xml /HelloFormStuff line 7 Android AAPT Problem
KennyH
maybe it's just an error of writing on StackO, but is your string file named string or stringS.because your wrote strings.xml here, an unfortunately, the correct spelling is without s...
Sephy
It's named strings.xml, according to the "hello, world" on the android development site (yes I'm new at this language!) it's correct. Ha, I just found it. I accidentally moved the values folder outside of the "res" folder. Moved it back and it fired up! Thanks Sephy for pointing me in the right direction!
KennyH
strangely enough, I have 2 string files (for I18n) one is string.xml and the other is strings.xml... and both are working. So I was wrong anyway...couldn't have seen that you moved your file :D
Sephy
+2  A: 

Accidentally moved the "values" folder outside of the "res" folder. Moved it back and it fired up!

KennyH
Please edit your original question or add a comment instead of a reply.
LucaB
If this solved the problem, could you mark this as the 'accepted answer'? That removes this post from the list of unsolved questions. @LucaB: Him answering his own question is fine; it means he can close the question by accepting this answer, which he couldn't do if he just edited his question.
Steve H
A: 

tried what KennyH write but it didn't solved my problem that appear while trying edit style.xml file in my android app, so I just delete the project from eclipse (not from disk of course !!) and import it back ,solved it for me in that case.

Zohar Adar