I have made a simple Android library for my personal use. Now I have to add some common string resources in the library module so that I can access them in the project wherever I use this library instead of creating the same string resources every time in every project I make.
But when I am trying to add a new string resource Android Studio is giving me an error saying:
"msg_example" is translated here but not found in default locale
I am not able to figure this out. Please help.
There is one similar question posted. But that does not resolves my issue. The answer says:
copy auth_strings.xml from values-en-rIN (locale values for INDIA you can use any locale) and paste it in default values folder.
According to the answer above, the person assumes that the developer is having a locale values directory like values-en-rIN and the string resources in it are getting the error. So he is asking to copy those string resources from that locale values directory to the default values directory which ultimately resolves the issue according to him.
But I don't have any other values directory than the default one. You can have a look in the following image:
So creating the string resources in it is giving me the error. My question is very simple and I have not done anything extra / wrong in the project which is giving me the error.
Hope you might have got the issue / difference between these two project scenarios.
Since you don't have any other values folder than the default folder then I think it's not your fault with the error message you're facing, so I guess it's a problem with Android Studio. You can fix it by invalidating the cache of Android Studio and restarting it. You can do this from the main menu:
File -> Invalidate Cache / Restart... -> Invalidate and Restart
Happy Coding!
Related
I am spell checking my project which is developed with android studio. I have multiple files to check spelling. I mean multiple string resource files and a few layouts(I know its a bad practive to have strings directly in layout, but had a little usage and previously developed).
Is there a way to find the find only the misspelled words? (like we do
find a word in whole project). I searched a lot and didnt find any solution.
thanks in advance
Note : My project is developed only for English. I don't use any other languages
If I understood you correctly, then you want to find the words, that you misspelled (write incorrectly) in your project.
To do this you can:
In main menu of Android Studio: Analyze - Inspect code - select Whole project - click OK
In the analyse results find Spelling
Inside it there will typically be 1 sub-item - Typo
Inside it you will find all found possible typos (misspelling) over the project including method\variable names as well as typos in the string resources.
String resource typos can be found under the module name folders.
k-9-master\k9mail\src\main\res\values\themes.xml:126: error: Error
retrieving parent for item: No resource found that matches the given
name '#android:style/Theme.Holo.Dialog'.
Why am I getting this error?
There are many possible causes of an error. However, if you simply do not see any reason this should be occurring, try a project clean, or simply create a new project and pull over all the files you intended to add to this project.
This is fairly likely to solve your issue as XML files often seem to cause me random problems - i.e. one day it is working, and the next time I open my project (e.g. if put it in different folder and bring it back to same location) it might not be working. I think Eclipse and Android Studio like to edit XML files by themselves sometimes without you knowing about it for some reason unbeknown to me.
I am using Intellij IDEA, i have a problem why when i copy project folder to another always result like this? have attribute Android: name is not allowed here even if i just copy old project to new project with 100% same as source but different like this. how to fix it?
I've searched high and low for people with the same question but have only found some variations (i.e. R file not generated at all) that don't help. I'm VERY new to Android development (day one, actually) but from some tutorials I've been reading, this behavior is unexpected. Basically, let's say I create a TextView in my activity's XML file and give it an appropriate android:id. I save the file (and all other files), but if I try to use findViewById in my Java file, the R.id.[view name] is not listed (and displays an error if I manually type it in). If I do a "Build Project," it works, but to have to run the Build command upon creation of every new component will be a huge burden! Has anyone else experienced this or have ideas on why it's happening? Thanks in advance!
If everything else you mentioned is correct, then the only way for you to NOT get the proper R variables is that you might be importing "android.R;" file in stead of your actual R file "your.package.R" which contains the variables you are looking for.
Regards!
You may have to tell your IDE to automatically rebuild changes you make. For example, in Eclipse this would be in: Window > Preferences > General > Workspace. Make sure Build automatically is checked.
I'm sure you can help such a newbie like I am.
I created a project in android and I want to use it as a model for next 10 and more apps, just changing the raw sources.
I mean I want to make some products i.e. 10 videocharts about norway, I make one project with the needed activity and resources so each app will differ only for the content value.
I will keep of course the same file name too if needed.
How can I save the project?
Cause I tried to make a new project from resource but I get an error on top of the tab saying Manifest is not present in the folder while manifest is actually there, and I cannot proceed further.
Thank you
ANgelo
This sounds like a place to use an Android library project.