I have developed an Android application with a feature that allows you to change the entire App locale language. It works perfectly in Debug mode. Unfortunately after the release in the Play Store this feature no longer works.
I have already seen these questions, where they say that it would be enough to edit the build.gradle file.
Android App Locale Not Working on Play Store Release
Android App Bundle with in-app locale change
android {
//...
//... removed for brevity
bundle {
language {
enableSplit = false
}
}
}
Unfortunately I developed it in Xamarin.Android and not in Android Studio and so I have no idea how I could modify that file and achieve the same result. I also do not want to support download on demand.
Could anyone help me please? Thanks in advance
I finally managed to found a solution and fix my issue.
First, I have added this file BundleConfig.json to my project.
{
"optimizations": {
"splitsConfig": {
"splitDimension": [{
"value": "LANGUAGE",
"negate": true
}]
}
}
}
Second, I edited my project's csproj file, adding a AndroidBundleConfigurationFile item under the release PropertyGroup.
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
...
<AndroidBundleConfigurationFile>BundleConfig.json</AndroidBundleConfigurationFile>
</PropertyGroup>
Then, I saved the solution, recreated my aab bundle, and locales were being changed correctly on release mode.
Sources:
https://learn.microsoft.com/en-us/xamarin/android/release-notes/10/10.3#support-for-android-app-bundle-configuration-files
https://developer.android.com/studio/build/building-cmdline#bundleconfig
Related
I cant update my app in Play Store because I get a message: The following unknown languages are configured for your App Bundle: zz
Update
This problem is a known bug and it has been rectified already. Try to update the SDK to the latest version will also solve this issue.
You can go to the application's build.gradle file, which is in android->defaultConfig.
Then choose the languages using resConfigs
android {
defaultConfig {
...
resConfigs "en", "fr" //pick the languages you'd like to use
}
}
Then rebuild the .aab file and try uploading.
I make a App.I created its bundle to publish.This is my first time to publish a app.
I google so that i don't mess up with my first publish.i Find this
https://medium.com/#AndreSand/android-app-bundle-96ac16b36875
it say to add this code to gradle file
bundle {
language {
enableSplit = true
}
density {
enableSplit = true
}
abi {
enableSplit = true
}
}
Now I am confused should i add this code and rebuild my bundle or my simple build bundle is enough to publish app.Is there any benefit to add this code to project? I am looking for the best way to build bundles so that i don't mess up with publish.
I've published apps with App Bundles and never added such code to my Gradle files. I'd say just use the default settings unless you have a good reason to customize them.
Just do Build -> Generate Signed Bundle / APK, and select Android App Bundle.
Android app bundle upload failed with error
Invalid SplitApkBundle. The bundle targets unknown languages: [gr]
Android Studio version 3.5
I tried
Clean & rebuild
Invalidate cache/restart
I had the same issue.
Invalid SplitApkBundle. The bundle targets unknown languages:[cb]
I solved by setting DSL to stop aapt package building the wrong language targets.
My app supports English and Chinese, therefore resConfigs only needs en and zh.
defaultConfig {
...
resConfigs "en", "zh-rTW", "zh-rCN"
}
Apply this to Android{}
bundle {
density {
// Different APKs are generated for devices with different screen densities; true by default.
enableSplit true
}
abi {
// Different APKs are generated for devices with different CPU architectures; true by default.
enableSplit true
}
language {
// This is disabled so that the App Bundle does NOT split the APK for each language.
// We're gonna use the same APK for all languages.
enableSplit false
}
}
in my case i was because i was using facebook account kit see wells answer it helped me out , i am in lining it here for future references
bundle {
density {
// Different APKs are generated for devices with different screen densities; true by default.
enableSplit true
}
abi {
// Different APKs are generated for devices with different CPU architectures; true by default.
enableSplit true
}
language {
// This is disabled so that the App Bundle does NOT split the APK for each language.
// We're gonna use the same APK for all languages.
enableSplit false
}
}
I had the same issue after downgrading facebook login implimentation to 5.8 it's fixed
implementation 'com.facebook.android:facebook-login:5.8.0'
In my case, I was working with Localization and Translation also. It worked. no more code.
Put this code in app-level build.gradle.
android {
bundle {
language {
enableSplit = false
}
}
...
}
I'm facing the same issue, I guess it is related to some resources added for Facebook's Account Kit (specifically the values inside /res/values-cb/values-cb.xml) I've tried uploading a version without this SDK and the playstore proccessed it properly
Switching to Facebook sdk version 5.13.0 solved the problem for me.
implementation 'com.facebook.android:facebook-login:5.13.0'
Our company has developed a android app for our customer. I want to create a new app with different name with same source code. I have already changed the app name. But when ever I load this new app to my device from android studio it gives error saying "alredy a new version of app is running in your device".
I want to release the same app with different name to the app store.
If you use android studio, use flavors to compile your app using different packages and different names
Have a look on this website : http://tools.android.com/tech-docs/new-build-system/build-system-concepts
change package name of application in manifest also change app name.
An addition to the other answers here is an example for how to do this:
android {
defaultConfig {
// your config
applicationId "com.packagename.appname"
}
productFlavors {
release {
// you config
applicationIdSuffix "release"
}
debug {
// you config
applicationIdSuffix "debug"
}
}
}
for more, feel free to read this manual
I am using Android Studio and Gradle to build Android applications. I would like to have different strings within the Java code based on which type of build it is (debug vs. release). What is the best way to do this?
For example - I want to have different URLs if I am in debug or release. Also, I want to specify different GUIDs and other keys / strings.
The obvious hacky way to do this is to do a search and replace of a string in AndroidManifest.xml or worse yet, in a Java file. This approach seems error prone and hacky to me - is there a better way to do this?
There are many ways you can do this, although I usually do
android {
buildTypes {
release {
buildConfigField("String", "URL", "your_url_on_release")
}
debug {
buildConfigField("String", "URL", "your_url_on_debug")
}
}
}
You then can access them on your java code by using:
BuildConfig.URL
You can test this using Android Studio Build Variants, by changing your application variant to debug or release ( e.g. http://prntscr.com/8waxkw)
You have many solutions to do this, here's a simple case:
buildTypes {
debug { ... }
release { ... }
}
productFlavors {
staging { ... }
production { ... }
}
build types are for build management proguarding, debugging, signing, etc.
productFlavors are for all app internal configuration.
If you want to add resources related to the flavours you can create and add to src/(flavor_name)/res/values/ folder your urls.xml config file.
With this, in android studio, you'll directly see, all the builds variants in the corresponding window and the right urls.xml file associated to the current context and leave the gradle config clean.
Of course, this method works also for any resource you would need in your app.
For more detail, you can read this : http://developer.android.com/tools/building/configuring-gradle.html#workBuildVariants
I would do it with product flavors as explained in this post.