My android application has several warnings of the following form when I run it in the emulator:
"Resources don't contain package for resource number <Hex Address>"
How can I fix these warnings? In particular, is there an easy way to find out what the hex address refers to?
These appear to be coming from the emulator, but it is now working fine, so these aren't errors. Still curious why they are occuring though
Just a guess, but isn't the hex address from R.java?
If so, you should be able to identify the resource pretty easily.
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.
Android crashes are often caused by a resource containing %1$ s when %1$s was intended.
To my surprise, Android Studio does not show these syntax errors:
↑ The real syntax error above is the %1$ s (makes the app crash), not the ellipsis that Android Studio highlights.
How to check for resource variable typos in Android Studio?
I am looking for the equivalent of lint --check StringFormatInvalid.
Context: Many semi-automatic language translation tools break variables, making apps crash.
What I have tried, does not work:
in Intellij it is possible to create custom inspections. I am not sure if it is possible in Android Studio.
Follow the link:
https://www.jetbrains.com/idea/help/creating-custom-inspections.html
edit:
after follow the steps in the link you see in the next image my created inspection:
In the next image you see the basic configuration of the inspection:
In the next two images you see the setting of the variables.
Only the used regex is not the ready. You must write it for general variable using (between $ and . is a space):
Every thing in strings.xml between <string> and </string> is merely a string for Android studio and lint. It will not identify syntax typos. Syntax errors/typos means error with code and not strings. You'll need to make sure that these are written right by yourself or create your own script to do these checks on the string.xml file. There is no inbuilt mechanism to identify code in strings and then check for syntax errors in them.
The highlighted thing with ellipses is there because it is a grammatical (optimization) error. If you make a spelling/grammatical mistake in strings.xml it will be highlighted. Example below:
But, if you intend to put in formats/code as strings it needs to be handled on your own or using some custom script that you'll need to write by yourself. Or as mentioned by #Rüdiger in his comment on the question, you can write unit test cases to check the sanity and integrity of your strings in strings.xml.
I have an Android App written using Xamarin for Visual Studio. When it runs I get the warning:
Failure getting entry for 0x01080acd (t=7 e=2765) (error -75)
I know there is something wrong with one of my resources, but I can't seem to figure out which resource has the ID of 0x01080acd. I tried looking at it while debugging in the activity OnCreate method, but it doesn't seem to work. Any suggestions on how I might track this down?
Jim
If that is truly a resource ID, open the file Resource.Designer.cs in the Resources folder of your project.
Search for 17304269 (decimal for 0x01080acd).
If there's a match, that'll be the ID.
Otherwise, it might be a global resource or some other value.
If there is a problem with a resource then check the naming, resources must not start with number and use only letters and _ and also not any capital latter.
Check also here for naming rules http://developer.android.com/guide/topics/resources/providing-resources.html#QualifierRules maybe you have made an icon for some resolutions and forget to make it for others,
like in this similar question android failure getting some entry
The encoding of some uncommon symbols is giving me problems, for instance the currency symbol of philippines is ₱, but in my phone it is displayed as "â,± 0,00".
So my question is, is it possible to check if a symbol is not supported in order to display something else? Or is there maybe a better option?
The problem was caused by the computer used to compile the projects. I had no problems what so ever with the symbol when I ran the project on my OSX-machine, but when using the computer which was running on Windows the encoding started behaving weirdly. I was also using two separate android phones which led me to believe that was the problem, but it was never the phone's fault.
Try to use "\u20B1" as literal - may be problem lies within source file encoding.
As far as i know there are no simple way to get information if specific char is present inside font. But if the symbol is unsupported it should be rendered as single char (box or something).
About hard way - get font source file (may be phone should be routed) and parse it. Or try to render symbol to temporary buffer and analyze if it similar to some clearly unsupported symbol.
hi I'm working in my android app. and suddenly today while I was working I got two errors
1- the "R can't be resolved as a variable" error.
2- and the "Couldn't resolve resource #string/app_name" erro, at the graphical view of .XML layouts.
I did lots of searching and lots of trial and error(clean, build, restart eclipse, restart laptop, and others but none could get me out of this trouble.
I also noticed that My R.Java is gone
I found while I do online searching that R.java could be gone"not auto generated" if there's error with XML or errors such as number 2 error.
last thing which I think might have caused the error is I added two elements in string.xml.. but anyway I have deleted them already.
so could any body help me how to jump this issue and continue with my development
At a guess I'd say that there is something wrong in your resource files which is stopping it from compiling them into the R file.
Take a good look at you string.xml file. The error is almost 100% there .
Have you forgotten to close some tag?
Check that your #string/app_name is well defined too ..
Remove this line: import android.R
note: R.java could be gone not auto generated unless you have no error in project.
now you count replace #string/app_name by "app name" and clean again. after find where have error
In my experience this message is almost always something to do with an error in one of your XML files: could be string.xml, any of your layouts, styles etc.
My advice would be to open up each one of them individually and check through them. An error in the layouts (res/layout/..) should be easy enough to spot (don't forget to check your res/menu/.. also). An error in one of the value XML files (res/values/..) can be tricker to spot. As some of the others have mentioned, a simple error in these files can cause this: one of my most common ones is to have typed "sting" instead of "string" or something similar.
I have often found that even after fixing some of these it is neccessary to close everything down and start Eclipse again.
Just import com.your.packagename.R
See my answer here Cannot find R.layout.activity_main