Migrate the FlowX Android renderer SDK from 5.9.x to 6.0.0.
Android SDK migration guide
FlowX.AI 6.0 moves the Android SDK to compileSdk 37, Android Gradle plugin 9 and Kotlin 2.4, and aligns the SDK’s names with the iOS and web SDKs. Update your build setup first, then the renamed SDK APIs.
The SDK now depends on OkHttp 5 and Retrofit 3. Gradle resolves your app to these versions even if you declare OkHttp 4 or Retrofit 2, so update any code in your app that uses APIs removed in these major versions. Align your app’s versions of these libraries with the SDK’s versions to avoid compatibility issues.
Migration steps
To build and run your container app with the 6.0 SDK, follow these steps in order:
Android Gradle plugin 9.1 requires at least Gradle 9.3.1, and 9.5 requires at least Gradle 9.6.0. Check the minimum for your version in the Android Gradle plugin release notes.
5
Remove the Kotlin Android plugin
Android Gradle plugin 9 compiles Kotlin by itself (built-in Kotlin), so the org.jetbrains.kotlin.android plugin must be removed:
[rootProject]/build.gradle.kts
plugins { id("org.jetbrains.kotlin.android") version "2.2.0" apply false}
With built-in Kotlin, your app compiles with the version of the Kotlin Gradle plugins you declare, such as the Compose Compiler plugin. The Kotlin version that Android Gradle plugin uses by default is too old to read the SDK’s classes. Use the same version for every Kotlin Gradle plugin your project declares, such as Parcelize or Serialization.
[rootProject]/build.gradle.kts
plugins { id("org.jetbrains.kotlin.plugin.compose") version "2.2.0" apply false id("org.jetbrains.kotlin.plugin.compose") version "2.4.21" apply false}
With an older Kotlin version, the build fails with an error like: The binary version of its metadata is 2.4.0, expected version is 2.2.0.
7
Make sure core library desugaring is enabled
The SDK requires core library desugaring. If your app does not enable it yet, add:
Flowx.getInstance().init( context = applicationContext, config = object : Config { ... override val imageBaseUrl = "URL to FlowX CMS Media Library" override val assetsBaseUrl = "URL to FlowX CMS Media Library" override val customHeaders: Map<String, String>? = mapOf("Custom-Header" to "custom header value") override val additionalHttpHeaders: Map<String, String>? = mapOf("Custom-Header" to "custom header value") ... }, ...)
The default value of the locale property changed from Locale.getDefault() to Locale.forLanguageTag("en-US"). If your app relies on the device locale for date, number and currency formatting, set it explicitly:
override val locale: Locale = Locale.getDefault()
9
Stop passing null to the setAccessToken method
The setAccessToken method no longer accepts null:
fun setAccessToken(accessToken: String?) fun setAccessToken(accessToken: String)
Remove the calls that clear the token (for example, on logout or after a failed login):
Flowx.getInstance().setAccessToken(null)
A token can’t be cleared once set. When another user logs in, set that user’s token. If no token is ever set, the SDK runs in anonymous mode. For details, see the Authentication section of the Android SDK reference.
Passing an empty string ("") no longer clears the token. The SDK sends it as is and the backend rejects the requests.
10
Rename the closeModalFunc parameter to onDismissRequested
The parameter of the startProcess and continueProcess methods was renamed. Its lambda now runs in the ProjectScope context:
Replace the deprecated CloseModalProcessScope type with ProjectScope, as described in the Replace deprecated APIs section.
11
Rename the imageBaseUrl parameter of the changeEnvironment method (if used)
fun changeEnvironment(baseUrl: String, imageBaseUrl: String, enginePath: String) fun changeEnvironment(baseUrl: String, assetsBaseUrl: String, enginePath: String)
Replace deprecated APIs
The following 5.9 names still compile in 6.0, but they are deprecated and will be removed in the next LTS release. Replace them now. The parameters are unchanged:
Deprecated (5.9)
Replacement (6.0)
Available on
CloseModalProcessScope
ProjectScope
The onDismissRequested lambda of startProcess and continueProcess