Android limit localizations - android

I am trying to publish an app that is currently only configured for English. When I upload my app to the Play store, it says localization for 'Default + 49 languages'? How do I disable all but English?

I've just noticed the same issue and after some investigation found the explanation. Thought I share this in addition to the already existing answer about the consequences:
As soon as your app includes a library that does support additional languages (e.g. the Google Play Services), your created apk is marked to support all those localizations as well!
You can check the properties of an apk by the way even without uploading it to the Google Play Store. Just run the following from the latest build-tools folder inside your Android Apk. For me this is at the moment cd ~ANDROID_HOME/build-tools/19.0.1
./aapt d badging <apk>
As it was suggested before, it is mostly important in which languages your app description is provided cause this is what the users actually see. In addition one can include the list of real supported languages in this description.
If you really would want to get rid of the additional languages you would need to delete the language specific res-folders from all libraries. In case of local copies of the libraries this is easy. I guess using gradle and maven it should be possible as well, but I don't consider it worth doing at the moment.

When you publish your app, if you wrote it only in English it will be published only in English.
If you want to limit your app to specific countries you can do this: On the developer console you have a tab of "PRICING AND DISTRIBUTION". You can choose the countries there. Here how it looks:

As others have pointed out, the issue is that if you include a library that supports other languages, all of those translations get pulled into your app and then the store assumes that you support those languages.
To stop the build tools from pulling in the unsupported languages, you can set filters on the 'aapt' packaging tool so that it will ignore particular files/directories.
The formatting for the filter can be found in the main ant 'build.xml' file in the sdk. (search for aapt.ignore.assets)
The default exclude list is:
!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~
I'd recommend that you keep this list and append any extra filter to the end of it.
e.g. If you wanted to exclude es-US (which is stored in directories with the extension -es-rUS) you would change the exclude list to:
!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~:<dir>*-es-rUS
This will exclude all directories ending in -es-rUS (note that the filters are case-insensitive, so <dir>*-eS-RuS would work just as well)
To do this for the command line:
aapt.exe <All of your normal commands for packaging> --ignore-assets <exclude-list>
For Ant/Eclipse builds add the following to your project's ant.properties file:
aapt.ignore.assets=<exclude-list>

Related

Inserting a dynamic feature to an esixting app bundle

I am reading the documentation up and down but I haven't been able to find a definite answer. Can I create and include a dynamic feature for my app bundle after the core apk compilation and upload it to Google Play separately or should they always be bundled together?
Any info will be appreciated.
Technically, they don't need to be compiled together and a dynamic feature module (DFM) could be added in an existing precompiled .aab file.
However, I don't know of a tool today that would be able to compile them separately and insert the DFM correctly in the AAB. You're free to try making one though, it shouldn't be too hard given that the AAB is just a zip file and the format is documented and opensource.
The only thing to make sure of really is that the package name and version code are the same for all modules.

How to exclude default resources from APK buld in Android Studio?

I'm facing a little "problem" affecting my APK files built in Android Studio (but the same problem affects my APKs even if I build them from command prompt).
The problem is this: if I rename .apk to .zip to see the files inside, or even if I analyze the .apk with the analyzer tool included in AS, I see in the "res" directory a lot of png files that I didn't include and I don't even use in my application.
I guess that they're standard icons used in Android, but I would like to exclude them from my built apk file.
Those file names are like "abc_ic_restofthefilenamehere.png"
(example: "abc_ic_star_half_black_16dp.png")
I would like to know if there's a way to exclude those file because I don't use them in my activities (my application is very simple, it doesn't even need icons for notifications or other kinds of similar things).
Is it possible to exclude them? Is there a way to do it if I build from the command prompt too (using gradle)?
Thank you very much!
-
Check out the documentation about how to Shrink your resources. This should remove any unused resources in your app.
Note however that some images will seem unused but are actually dependencies (possibly indirect) of a theme you may be depending on, so that's why those would remain.

Creating multiple new project apks from one parent project ionic

This question may seems old to some you guys or may be silly or may interesting , but i really want to know this.I build an application in ionic but now as i want to make such automated system like i can make multiple application's apks from the existing parent code with different package names and version codes.I want to make such a script that when i run it on command line i will be able to build a new apk from the parent code just by changing logo and package name , version code , version name.As the functionality will remain same only base url , package name , version code need to get changed . so i want this process to reduce my efforts in generating new apks manually.
I done some R&D and found some links but i am not able to understand them clearly , as i never use ant or maven earlier , After seing such links i believe that this can be possible . So , i just want to get sure of this and want to take idea from all the experts here in stackoverflow.I really want to learn this amazing thing.
links are as follows :-
Create an Android project from existing one
How to compile APK from command line?
http://www.simpligility.com/2010/11/release-version-management-for-your-android-application/
Found This But it is Unanswered :-
Generate multiple APK's with same code base using ANT
I found this But i do not know how ruby works and how to use this in ionic framework:-
http://iambrucewang.blogspot.in/2012/03/create-multiple-android-apps-from-one.html
I am using Linux mint and eclipse as IDE .
Please enlighten me with your expertise knowledge.I will be very grateful to you all.
Regards
First of all: Don't use Ecplise anymore as an Android IDE. The Eclipse Support for Android is outdated and Android Studio will bring you joy.
Regarding your question: You are asking about build types (i.e. develop, release, ...) and build flavors (paid, free, whatever, ...).
You can define these two in the gradle file (don't use Ant anymore. For Android it's as outdated as Ecplise). For example you define two flavors: logoOne and logoTwo. For each flavor you can either use different implementations for classes who need to do different things OR you can also define BuildConfig Fields with more or less hardcoded information.
More about this here:
https://developer.android.com/studio/build/build-variants.html
or on youtube here:
https://www.youtube.com/watch?v=cD7NPxuuXYY
This will generate seperate APKs for each build variant (= combination of buildtype and buildflavor)

Localization for a library module in Android

We are building an app that imports, via Artifactory, a collection of libraries that are then referenced from the main app.
We are in the process of localizing our app. We can localize our libraries and verify it works by directly using the libraries in a test app. When the libraries are pushed to our artifactory, we can then import, via gradle, the libraries for use in our app.
We can verify that making code changes or even changes to English strings in the libraries all work, and when pulled into the main app, any such changes are reflected correctly. However, while we have localized our libraries (into Spanish), when pulling the localized libraries into the main, the Spanish strings are not used. Instead, it uses the default (English) strings. We have looked at the libraries on our artifactory, downloaded the AARs and verified that the snapshots do in fact contain the localized strings but for reasons we can't figure out when imported into the main app, it does not use them.
We're confused why this is the case - wether we are doing something wrong or if there is a bug in gradle or Android.
Does anyone have any insight? I apologise for the vagueness but the issue is rather esoteric so I'm not sure what code if any might be relevant to solving the issue. Feel free to ask for further clarification.
UPDATE:
We decided to import the .AAR directly, by placing it in a libs/ directory and referencing it in our Gradle build. It now works fine, the library in question is correctly localized.
So it would seem the issue comes from when the snapshot is downloaded from the repository.
The app is looking at the wrong version of the library: the previously released version rather than the latest SNAPSHOT.
Full disclosure: James and I work together.

Can i remove google play services language files?

I've an android application and i use admob.
Do i need to include the entire languange pack located to google-play-services_lib/res/values-COUNTRYCODE.xml?
I tried to remove them and apk file resulted much smaller.
My app is currently served only in my country.
Use resConfig "en" build configuration inside your app's build.gradle file.
This will instruct gradle to remove all other languages other than english. This immensely helps in reducing the size of the apk by upto 20-40% in some cases.

Categories

Resources