How to fix 'Invalid SplitApkBundle' failure [duplicate] - android

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'

Related

How to create bundle(.aab) to publish app?

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.

app bundle default language is not system language

My project is an application that supports In-App Language Switching. The app bundle I packaged can be installed directly through the bundletool tool to correctly display the language set by the system, and the apk directly installed can also display the language set by the system correctly, but when I download from Google When play downloads my app (app bundle uploaded by google play), my app does not display the language set by the system, but the language corresponding to my country. All installation methods can be in the app after installation Switch language normally, how should I solve this problem。
my gradle config:
android {
defaultConfig {
...
multiDexEnabled true
...
ndk {
abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
}
resConfigs "en-rUS", "zh-rCN", "zh-rTW"
}
bundle{
language{
enableSplit false
}
}
}
This problem has been solved. The reason is that the allowBackup attribute is configured as true in the Application attribute in the AndroidMainfest file. Change it to false. In the case of true, google service will back up the app configuration file, but I don’t know exactly what files to back up and how the backup is done. In addition, based on the problems I encountered in the process of using multiple languages, some tips for switching between multiple languages in the app are given.
Tip 1: For androidx.appcompat.appcompat dependency, it is best to use version 1.0.2, other versions will cause the in-app switching of multiple languages on some phones
Tip 2: bundle{
language{
enableSplit false
}
}
If you need to switch multiple languages in the app, it is recommended to change this attribute to false, only for bundle packages.
Tip 3: Remember to configure
resConfigs "ms-rMY", "zh-rCN", "zh-rTW"
Otherwise, multi-language resources may not be packaged in the apk when packaging
Finally, my build.gradle configuration file
android{
defaultConfig{
bundle{
language{
enableSplit false
}
}
resConfigs "ms-rMY", "zh-rCN", "zh-rTW"
}
}
dependencies{
implementation group: 'androidx.appcompat', name: 'appcompat', version: "1.0.2"
}

Invalid SplitApkBundle. The bundle targets unknown languages: [gr]. google play console

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'

'ProductFlavor.resConfigs' has a value 'auto' which is obsolete and has not been replaced

How to fix the warning below? Are there any alternatives to 'auto'?
Warning:DSL element 'ProductFlavor.resConfigs' has a value 'auto' which is obsolete and has not been replaced. It will be removed at the end of 2018
android {
...
flavorDimensions "device", "paid", "market"
productFlavors {
phone {
// Phone config version for the application
resConfigs ("auto")
dimension "device"
matchingFallbacks = ['mobile']
}
...
}
...
}
This is the error after updating to Android Studio 3.1:
Based on the official advise here the best thing to do is removing the tag entirely if you support all the languages or supply an array with the language's code your app supports like:
resConfigs "en", "de", "it", "fr" // etc. etc.
More info:
This is one of the resources optimization proposed by the official documentation here so i decided to test this flag with those FirebaseUI dependencies in a sample project
implementation "com.firebaseui:firebase-ui-auth:$firebase_ui_version"
implementation "com.firebaseui:firebase-ui-database:$firebase_ui_version"
implementation "com.firebaseui:firebase-ui-storage:$firebase_ui_version"
creating the debug APK with both the options and those are the results:
Using resConfigs "auto" the debug APK was: 3,793 KB
Using resConfigs "en" (so 1 language only) the debug APK was: 3,294 KB
This means that with all the string resources for all the languages of those dependencies I got only ~500KB of size increase. That's something you could reason about, you definitely should make a test with the dependencies you use and see if the size increase is negligible or not and consequently decide to provide the list of supported languages or remove the resConfigs option.
PS: If you are using Android FirebaseUI this was one of the suggested optimizations, I've created an issue here about the thing and this has been solved immediately by the awesome guy called SUPERCILEX
auto is no longer supported because it created a number of issues with multi-module projects. Instead, you should specify the locale that your app supports. Android plugin 3.1.0 and higher ignore the auto argument, and Gradle packages all string resources your app and its dependencies provide.
com.android.tools.build:gradle:3.2.0-alpha08 BaseFlavor.java
* <p><b>Note:</b> <code>auto</code> is no longer supported because it created a number of
* issues with multi-module projects. Instead, you should specify the locale that your app
* supports, as shown in the sample above. Android plugin 3.1.0 and higher ignore the <code>auto
* </code> argument, and Gradle packages all string resources your app and its dependencies
* provide.

Android Studio + Gradle to create different configurations

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.

Categories

Resources