If your project already uses several libraries, it is possible that by adding Didomi it reaches the limit of 64K references. In this case, it is necessary to enable multidex in your project: https://developer.android.com/studio/build/multidex#groovy
Example of error that can be caused by reaching the 64K limit:
FAILURE: Build failed with an exception.* What went wrong:Execution failed for task ':launcher:transformClassesWithDexBuilderForRelease'.> com.android.build.api.transform.TransformException: java.lang.IllegalArgumentException: java.lang.IllegalArgumentException
For example: to add Hebrew language to the filtered list of language, you need to use iw.
App bundles
The Didomi SDK can be configured to restrict the languages it supports. If the user device language is not in the supported languages list, and app is distributed with Android App Bundles on the play store, it is possible that texts are removed from the downloaded app. In this case, all the texts will be displayed in english, except the custom texts.
To avoid this behavior, it is possible to either
disable the splitting by language in App Bundle configuration.
Didomi SDK uses the Zipline library (https://github.com/cashapp/zipline) to interpret local javascript code. Currently the Zipline dependency version is 1.18.0.
Since Didomi SDK version 2.36.0, it is possible to exclude this library from the dependencies,. In this case the Didomi SDK will use a WebView instance to evaluate javascript.
You can exclude Zipline in the build.gradle file, when adding the Didomi dependency:
At the moment, Didomi uses javascript for the following features:
Didomi Consent String
GPP
GCM privacy signals
Didomi SDK does not interpret remote javascript. All the javascript code is embedded with the SDK release.
Drawbacks
Excluding Zipline reduces the size of the Didomi SDK, however javascript operations will be less performant.
To support the Didomi javascript features, the device WebView version must be ≥ version 61.
Other uses of WebView from a different process in the same app can result in a crash. This can happen when a WebView is used in a Service or when using specific libraries.
private lateinit var splitInstallManager: SplitInstallManager
override fun attachBaseContext(newBase: Context) {
super.attachBaseContext(newBase)
splitInstallManager = SplitInstallManagerFactory.create(newBase)
SplitCompat.installActivity(this)
}
private fun onLanguageChanged(languageCode) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && !splitInstallManager.installedLanguages.contains(languageCode)) {
// Creates a request to download and install additional language resources.
val request = SplitInstallRequest.newBuilder()
// Uses the addLanguage() method to include needed language resources in the request.
.addLanguage(Locale.forLanguageTag(languageCode))
.build()
// Submits the request to install the additional language resources.
splitInstallManager
.startInstall(request)
.addOnFailureListener { (...) }
.addOnCompleteListener { task ->
if (task.isSuccessful) {
(...)
// Recreate activity so new language is available
recreate()
}
}
return
}
}