While trying to add localized resources for the Sakha language in my android app, I kept getting errored out with the following message:
[aapt] invalid resource directory name: /Users/yuvipanda/code/WikipediaMobile/res/values-bho
BUILD FAILED
/Users/yuvipanda/adk/tools/ant/build.xml:539: The following error occurred while executing this line:
/Users/yuvipanda/adk/tools/ant/build.xml:568: null returned: 1
Trying to add variants for any three letter language code gives me the same error (values-bho, values-kbd, values-sah, etc).
Is there a trick I'm missing, or does Android not support having localizations for languages with only 3 letter language codes?
From Providing Alternative Resources in the developer guides, it looks like Android supports only two-letter ISO 639-1 language codes.
The naming convention is different for apps that include three letter language codes. Instead of having your resources in the folder values-bho, put them into a folder called values-b+bho. the -b+ identifies the following language tags as pertaining to BCP 47 (language codes, dialects, regions, scripts, and the rest of the kitchen sink), rather than ISO 639-1 (two-letter codes).
Related
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).
I just update to new version of Android Studio and my app stop this displaying in the preview screen.
The error that I get is this:
Error:Execution failed for task ':app:mergeDebugResources'.
C:\Users\So BE\AndroidStudioProjects\SustainableBusinessCard\app\src\main\res\drawable\SDlogo_black.jpg:
Error: 'S' is not a valid file-based resource name character:
File-based resource names must contain only lowercase a-z, 0-9, or
underscore
I try to change the name of image "SDlogo_black" to "sdlogoblack", but it still does not work, following the suggestion of this question
Any help will be appreciated it.
According to docs, while naming to resources in Android SDK you have to name it in only lowercase a-z, 0-9 or underscore. After naming resource according to docs, just clean and rebuild your project.
I hit this error and found no hits for the error message, so I thought I'd share the solution I came up with to save anyone else facing the problem repeating my work.
When writing a new Android library (apklib) for use in a (large) application, I'm getting the following error during dexing when I add my new project as a dependency:
trouble writing output: Too many field references: 70185; max is 65536.
You may try using --multi-dex option.
References by package:
<...long list of packages with field counts elided...>
The particular build step it fails on is:
java -jar $ANDROID_SDK/build-tools/19.0.3/lib/dx.jar --dex \
--output=$PROJECT_HOME/target/classes.dex \
<... long list of apklib and jar dependencies elided ...>
Using --multi-dex as recommended by the error message might be a solution, but I'm not the owner of the application project and it already has a large complex build process that I would hesitate to change regardless.
I can reproduce this problem with a no-op test library project that has literally no fields, but in the error output it's listed as having 6000+ fields. Of the packages listed in the error output, there are a handful with similar 6k+ field counts, but then the vast majority have more plausible <1k field counts.
This problem is similar to the "Too many methods" problem that Facebook famously hacked their way around. The FB solution seems insane, and the only other solutions I've found (e.g., this Android bug ticket, or this one, this SO answer, this other SO answer) all involve changing the main app's code which is well beyond the scope of what I want to do.
Is there any other solution?
The solution was to change the package in the AndroidManifest to match the main application's package.
A manifest like this:
<manifest package="com.example.testlibrary" ...
resulted in 6k+ fields and build failure. Changing it to match the main application's package
<manifest package="com.example.mainapplication" ...
resulted in the project building successfully.
Note that only the package in the manifest is changing, I did not make any changes to the library's Java source or its layout (the Java package was still com.example.testlibrary with directory structure to match).
I hypothesize that the different package name is causing all the Android fields to be included again under that package. All the packages in the error listing with 6k+ fields had a different package name than the main application.
I also (later, grr), found this blog post which details the same problem and the eventual same solution.
Well I have a single language android application that I translated strings in res/values/strings.xml to make it multi language application. I made for instance values-fr/strings.xml, values-es/strings.xml ...
When compiling my application, I get this error
mayapp/res/values-fr/strings.xml:1: error: Error parsing XML: XML declaration not well-formed
mayapp/res/values-es/strings.xml:1: error: Error parsing XML: XML declaration not well-formed
How to solve this problem.
I need your help since I'am new in android development.
use numerical code for special character:
<string name="app_name">Répondeur</string>
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?
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>
If you're using Eclipse try using (from menus above):
Project->Clean....
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