Localization Example Issue - android

I am testing localization example given on http://developer.android.com/resources/tutorials/localization/index.html. For this i have created android 2.3.3 level 10 application.
There is a step mentioned in the tutorial:
Localize the Images
As shown in Table 2, the application needs six more drawable folders, each containing a flag.png icon. Add the needed icons and folders to your project:
Save this German flag icon as res/drawable-de-rDE/flag.png in the application's project workspace.
For example:
1. Click the link to open the flag image.
2. Save the image in your-workspace/HelloL10N/res/drawable-de-rDE/ .
But in the res folder i have three folders drawable-hdpi, drawable-mdpi and drawable-ldpi.
I know that it is for different screen resolutions. Similarly i have values-dr folder containing strings.xml file.
I have made drawable-hdpi-de-rDE folder for german and similar folders for other languages. But i am getting error:
[2011-04-04 14:34:32 - HelloL10N] (skipping index file 'C:\Documents and Settings\abc\workspace\HelloL10N\res\drawable-hdpi\Thumbs.db')
[2011-04-04 14:34:32 - HelloL10N] C:\Documents and Settings\abc\workspace\HelloL10N\res\values-fr\strings.xml:4: error: Apostrophe not preceded by \ (in Irai-je te comparer au jour d'été?)
[2011-04-04 14:35:14 - HelloL10N] (skipping index file 'C:\Documents and Settings\abc\workspace\HelloL10N\res\drawable-hdpi\Thumbs.db')
[2011-04-04 14:35:14 - HelloL10N] invalid resource directory name: C:\Documents and Settings\abc\workspace\HelloL10N\res/drawable-hdpi-de-rDE
[2011-04-04 14:35:14 - HelloL10N] invalid resource directory name: C:\Documents and Settings\abc\workspace\HelloL10N\res/drawable-hdpi-en-rCA
[2011-04-04 14:35:14 - HelloL10N] invalid resource directory name: C:\Documents and Settings\abc\workspace\HelloL10N\res/drawable-hdpi-fr-rCA
[2011-04-04 14:35:14 - HelloL10N] invalid resource directory name: C:\Documents and Settings\abc\workspace\HelloL10N\res/drawable-hdpi-fr-rFR
[2011-04-04 14:35:14 - HelloL10N] invalid resource directory name: C:\Documents and Settings\abc\workspace\HelloL10N\res/drawable-hdpi-ja-rJP
I am unable to understand the reason for such an issue.
One more thing i am curious to know whether i have to create three resources in place of one for e.g. i have one image file so i have to upload it in drawable-hdpi, drawable-mdpi and drawable-ldpi with different screen resolutions?
Please help me on this
Thanks
Pankaj

To do what you want, you must create folders named like this :
drawable-de-rDE-hdpi,
drawable-de-rDE-mdpi,
drawable-de-rDE-ldpi, ...
I hope will be helpful

use drawable-de-rDE-mdpi instead of drawable-hdpi-de-rDE .

I was experiencing the same problem in another Android example then I deleted those Thumds.db files, and that fixed it.

Related

Xamarin Forms Error "invalid resource directory name: /Path/res Icon "res Icon"

Yesterday everything worked fine and the app get build successfully.
But when I want to build the app now, I always get the following error:
invalid resource directory name:
/path/to/project.android/obj/Debug/Ip/26/jl/res Icon "res Icon".
Does somebody know how to fix that?
It seems like you have a space character in the name of your resource file or directory which is not allowed:
"File-based resource names must contain only lowercase a-z, 0-9, or underscore"
I don't know how but this fixed my problem.
Use incremental Android packaging system (aapt2).

Invalid resource directory name for android dimens

Hi,I have a dimens resource files with different screen densities,everything worked just fine,I tested it,but suddenly I got an error:
Error: Invalid resource directory name
res\values-(xxxhdpi): Error: Invalid resource directory name
Any advice and suggestion will be greatly appreciated.Thx.
Switch to Project view instead of Android view and remove the parenthesis in the folder. It should only be values-xxxhdpi
You need to create different values folder for different screens.
Then, inside the values directory, you have to place your dimens.

any lib extract android resources.arsc

I'm looking for a lib to extract ids and values which stored in res/values/strings.xml, for example app_name. I unzipped the apk, however strings.xml cannot be found. I use aapt to extract string values, however the corresponding ids are missing. I have tried apktool to decompile the apk and then parse the xml file to get the keys and values. However, it's not an efficient way, almost 12 seconds per apk. I have more than 10,000 android malwares to be processed. This method really cost me too much time.
I found that all the ids and values in res/values/strings.xml is encoded into the file resources.arsc. I wonder if there is lib to extract ids and values from resources.arsc?
Use appt for android-sdk (ex:- /build-tools/27.0.3/aapt )
./aapt dump resources ./debug.apk
Package Groups (1)
Package Group 0 id=0x7f packageCount=1 name=com.dianping.example.activity
Package 0 id=0x7f name=com.dianping.example.activity
type 1 configCount=3 entryCount=1
spec resource 0x7f020000 com.example.activity:drawable/ic_launcher: flags=0x00000100
config mdpi-v4:
resource 0x7f020000 com.example.activity:drawable/ic_launcher: t=0x03 d=0x00000000 (s=0x0008 r=0x00)
config hdpi-v4:
resource 0x7f020000 com.example.activity:drawable/ic_launcher: t=0x03 d=0x00000001 (s=0x0008 r=0x00)
config xhdpi-v4:
resource 0x7f020000 com.example.activity:drawable/ic_launcher: t=0x03 d=0x00000002 (s=0x0008 r=0x00)
type 2 configCount=1 entryCount=1
spec resource 0x7f030000 com.dianping.example.activity:string/app_name: flags=0x00000000
config (default):
resource 0x7f030000 com.dianping.example.activity:string/app_name: t=0x03 d=0x00000003 (s=0x0008 r=0x00)
This link might help http://elinux.org/Android_aapt
It's not a proper library, but you can borrow code from an official Google project called ArscBlamer:
https://github.com/google/android-arscblamer

Invalid file name: must contain only [a-z0-9_.]

I have file /FavoriteTwitterSearches/res/menu/FavoriteTwitterSearches.xml in my android project. When I want to run the project - i get error "res\menu\FavoriteTwitterSearches.xml: Invalid file name: must contain only [a-z0-9_.]". But if I change the file name for a-z,0-9 there is another errors in /R.java/R/string/confi
like
Multiple markers at this line
- Duplicate field R.string.confi
- Syntax error on token "rmTitle", delete
or
Multiple markers at this line
- Syntax error on token "rmMessage", delete
this token
"res\menu\FavoriteTwitterSearches.xml: the res folder accepts only small case letters
change your file name to
favoritetwittersearches and it will work
Capital letters are not allowed in naming any .xml files. using it will give you an error.

No resource found that matches the given name in Manifest

I'm getting this error when trying to build the application. The xml editor did not highlight both error as missing. As the file/string are already there.
android-apt-compiler: [XXX]
D:\private\xxx\android\XXX\src\AndroidManifest.xml:35: error: Error:
No resource found that matches the given name (at 'icon' with value
'#drawable/ic_launcher').
android-apt-compiler: [XXX]
D:\private\xxx\android\XXX\src\AndroidManifest.xml:233: error: Error:
No resource found that matches the given name (at 'value' with value
'#string/FacebookAppID').
The project structure is like this:
ProjectFolder
|-external_lib
|-src
|-src (actual source)
|-res
|-...
I can confirm that both file is already in the project. As I use IntelliJ, I could just Ctrl + click then it open those files for me. However, I'm still getting this error.
I checked with both Google and SO. Most of the issues were about not having the files or storing in different folders. Which I can ensure that it is in the right place alongside hundred other files and strings.
Another issue is about % sign in strings.xml. I tried searching for "%" and nothing is found in the file.
Shutting down IDE and reopen it doesn't help, nor rebuilding the project. How could I get the app to build?
Look for any error message during the resource compilation.
Sometimes, if you have resource filenames containing illegal characters (such as underscores or uppercase letters), the whole process fails almost silently, and the IDE can't find any resources anymore.
I'm not sure that it's what is happening in your case, but I did eventually encounter such issues...

Categories

Resources