> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flowx.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Android SDK

> 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.

### System requirements

System requirements:

* **minSdk = 26** (unchanged)
* **compileSdk = 37**

The SDK library was built using:

* **[Android Gradle Plugin](https://developer.android.com/build/releases/gradle-plugin) 9.5.0**
* **[Gradle](https://gradle.org/releases/) 9.8.2**
* **[Kotlin](https://kotlinlang.org/) 2.4.21**

Your container app must build with at least:

* **Android Gradle Plugin 9.1.0**
* **Gradle 9.3.1** (the minimum depends on your Android Gradle Plugin version)
* **Kotlin 2.4**
* **JDK 17**

### Library dependencies

| Dependency | 5.9.x | 6.0 |
| - | - | - |
| [Android Core KTX](https://developer.android.com/kotlin/ktx#core) | 1.16.0 | **1.19.1** |
| [Android Activity Compose](https://developer.android.com/jetpack/androidx/releases/activity) | 1.10.1 | **1.13.0** |
| [Compose BOM](https://developer.android.com/jetpack/compose/bom/bom-mapping) | 2025.09.01 | **2026.09.00** |
| [Compose Navigation](https://developer.android.com/develop/ui/compose/navigation) | 2.9.1 | **2.10.2** |
| [Android Lifecycle](https://developer.android.com/jetpack/androidx/releases/lifecycle) | 2.9.1 | **2.11.0** |
| [Kotlin Coroutines](https://kotlinlang.org/docs/coroutines-overview.html) | 1.10.2 | **1.11.0** |
| [Android DataStore](https://developer.android.com/jetpack/androidx/releases/datastore) | 1.1.7 | **1.3.0** |
| [Android Security](https://developer.android.com/jetpack/androidx/releases/security) | 1.1.0-beta01 | **1.1.0** |
| [OkHttp BOM](https://square.github.io/okhttp/) | 4.12.0 | **5.5.1** |
| [Retrofit](https://square.github.io/retrofit/) | 2.12.0 | **3.0.0** |
| [Coil BOM](https://coil-kt.github.io/coil/) | 3.4.0 | **3.6.3** |
| [Google Protobuf](https://github.com/protocolbuffers/protobuf/tree/main/java#use-java-protocol-buffers-on-android) | 4.31.1 | **4.36.2** |
| [Mozilla Rhino](https://github.com/mozilla/rhino) | 1.8.0 | **1.9.2** |
| [Accompanist Permissions](https://google.github.io/accompanist/permissions/) | 0.37.3 | 0.37.3 |
| [Moshi](https://github.com/square/moshi) | 1.15.2 | 1.15.2 |
| [Android Core Library Desugaring](https://developer.android.com/studio/write/java8-support#library-desugaring) | 2.1.5 | 2.1.5 |

> [!WARNING]
>
> 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.

> [!TIP]
>
> 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:

**1. Update the SDK version**

```kotlin [rootProject]/app/build.gradle.kts theme={"dark"}
implementation("ai.flowx.android:sdk:<5.9.x version>") // [!code --]
implementation("ai.flowx.android:sdk:<6.0 version>") // [!code ++]
```

> [!NOTE]
>
> Find the SDK version that matches your platform version in **Release Notes → v6.0 → Deployment guidelines → Component versions**.

**2. Increase the `compileSdk` version to `37`**

```kotlin [rootProject]/app/build.gradle.kts theme={"dark"}
android {
    compileSdk = 35 // [!code --]
    compileSdk = 37 // [!code ++]
}
```

> [!NOTE]
>
> The SDK and its AndroidX, OkHttp and Coil dependencies require `compileSdk` 37. Raising `targetSdk` is not required.

**3. Update the `Android Gradle plugin` version to at least `9.1.0`**

```kotlin [rootProject]/build.gradle.kts theme={"dark"}
plugins {
    id("com.android.application") version "8.10.0" apply false // [!code --]
    id("com.android.application") version "9.5.0" apply false // [!code ++]
}
```

> [!TIP]
>
> Android Gradle plugin 9 is a major release with breaking build changes. Consult the [Android Gradle plugin 9.0 release notes](https://developer.android.com/build/releases/agp-9-0-0-release-notes).

**4. Update the `Gradle` version**

```properties [rootProject]/gradle/wrapper/gradle-wrapper.properties icon="ini" theme={"dark"}
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip # [!code --]
distributionUrl=https\://services.gradle.org/distributions/gradle-9.8.2-bin.zip # [!code ++]
```

> [!NOTE]
>
> 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](https://developer.android.com/build/releases/gradle-plugin).

**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:

```kotlin [rootProject]/build.gradle.kts theme={"dark"}
plugins {
    id("org.jetbrains.kotlin.android") version "2.2.0" apply false // [!code --]
}
```

```kotlin [rootProject]/app/build.gradle.kts theme={"dark"}
plugins {
    id("org.jetbrains.kotlin.android") // [!code --]
}
```

> [!TIP]
>
> Consult the [Migrate to built-in Kotlin](https://developer.android.com/build/migrate-to-built-in-kotlin) guide.

**6. Update the `Kotlin` version to at least `2.4`**

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.

```kotlin [rootProject]/build.gradle.kts theme={"dark"}
plugins {
    id("org.jetbrains.kotlin.plugin.compose") version "2.2.0" apply false // [!code --]
    id("org.jetbrains.kotlin.plugin.compose") version "2.4.21" apply false // [!code ++]
}
```

> [!WARNING]
>
> 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`.

> [!TIP]
>
> Use the same version for every Kotlin Gradle plugin your project declares (for example, Parcelize or Serialization).

**7. Make sure core library desugaring is enabled**

The SDK requires core library desugaring. If your app does not enable it yet, add:

```kotlin [rootProject]/app/build.gradle.kts theme={"dark"}
android {
    compileOptions {
        isCoreLibraryDesugaringEnabled = true // [!code ++]
    }
}
dependencies {
    coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.5") // [!code ++]
}
```

**8. Rename the `imageBaseUrl` and `customHeaders` properties of the `Config` interface**

`imageBaseUrl` is now `assetsBaseUrl`, and `customHeaders` is now `additionalHttpHeaders`:

```kotlin [rootProject]/app/src/main/[java|kotlin]/com/example/MyApp.kt theme={"dark"}
Flowx.getInstance().init(
    context = applicationContext,
    config = object : Config {
        ...
        override val imageBaseUrl = "URL to FlowX CMS Media Library" // [!code --]
        override val assetsBaseUrl = "URL to FlowX CMS Media Library" // [!code ++]
        override val customHeaders: Map<String, String>? = mapOf("Custom-Header" to "custom header value") // [!code --]
        override val additionalHttpHeaders: Map<String, String>? = mapOf("Custom-Header" to "custom header value") // [!code ++]
        ...
    },
    ...
)
```

> [!NOTE]
>
> 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:
>
> ```kotlin theme={"dark"}
> override val locale: Locale = Locale.getDefault()
> ```

**9. Stop passing `null` to the `setAccessToken` method**

The `setAccessToken` method no longer accepts `null`:

```kotlin theme={"dark"}
fun setAccessToken(accessToken: String?) // [!code --]
fun setAccessToken(accessToken: String) // [!code ++]
```

Remove the calls that clear the token (for example, on logout or after a failed login):

```kotlin theme={"dark"}
Flowx.getInstance().setAccessToken(null) // [!code --]
```

> [!WARNING]
>
> Passing an empty string (`""`) no longer clears the token. The SDK sends it as is and the backend rejects the requests.

> [!NOTE]
>
> 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](https://docs.flowx.ai/6.x/sdks/android-renderer.md#authentication) section of the Android SDK reference.

**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:

```kotlin theme={"dark"}
Flowx.getInstance().startProcess(
    ...
    closeModalFunc = { processName -> ... }, // [!code --]
    onDismissRequested = { processName -> ... }, // [!code ++]
)

Flowx.getInstance().continueProcess(
    ...
    closeModalFunc = { processName -> ... }, // [!code --]
    onDismissRequested = { processName -> ... }, // [!code ++]
)
```

> [!TIP]
>
> Replace the deprecated `CloseModalProcessScope` type with `ProjectScope`, as described in the [Replace deprecated APIs](#replace-deprecated-apis) section.

**11. Rename the `imageBaseUrl` parameter of the `changeEnvironment` method (if used)**

```kotlin theme={"dark"}
fun changeEnvironment(baseUrl: String, imageBaseUrl: String, enginePath: String) // [!code --]
fun changeEnvironment(baseUrl: String, assetsBaseUrl: String, enginePath: String) // [!code ++]
```

### 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:

| Deprecated (5.9) | Replacement (6.0) | Available on |
| - | - | - |
| `CloseModalProcessScope` | `ProjectScope` | The `onDismissRequested` lambda of `startProcess` and `continueProcess` |
| `replaceSubstitutionTag(key)` | `getSubstitutionTagContent(key)` | `ProjectScope`, `CustomComponentScope`, `CustomLoaderScope` |
| `getMediaResourceUrl(key)` | `getMediaItemUrl(key)` | `ProjectScope`, `CustomComponentScope`, `CustomLoaderScope` |
| `getEnumeration(name, parentName)` | `getEnumerationItems(name, parentName)` | `ProjectScope`, `CustomComponentScope`, `CustomLoaderScope` |
| `executeAction(action, params)` | `runAction(action, params)` | `CustomComponentScope` |
| `executeUploadAction(action, fileUri, mimeType, params)` | `runUploadAction(action, fileUri, mimeType, params)` | `CustomComponentScope` |
| `configureUpdateState(enabled)` | `setUpdateStateEnabled(enabled)` | `Flowx` |

> [!TIP]
>
> Android Studio offers a **Replace with** quick fix on every deprecated call.

These changes are reflected in an actual implementation as shown below:

```kotlin theme={"dark"}
import ai.flowx.android.sdk.api.CloseModalProcessScope // [!code --]
import ai.flowx.android.sdk.api.ProjectScope // [!code ++]

// close process confirmation alert
@Composable
private fun CloseModalProcessScope.CloseModalProcessConfirmAlert(show: MutableState<Boolean>) { // [!code --]
private fun ProjectScope.CloseModalProcessConfirmAlert(show: MutableState<Boolean>) { // [!code ++]
    ...
    Text(replaceSubstitutionTag("@@close_message")) // [!code --]
    Text(getSubstitutionTagContent("@@close_message")) // [!code ++]
}

// custom component
flowxScope.executeAction(action = it, params = JSONObject()) // [!code --]
flowxScope.runAction(action = it, params = JSONObject()) // [!code ++]

// custom loader
flowxScope.replaceSubstitutionTag(text) // [!code --]
flowxScope.getSubstitutionTagContent(text) // [!code ++]
flowxScope.getMediaResourceUrl(key) // [!code --]
flowxScope.getMediaItemUrl(key) // [!code ++]
```

## Related resources

> [card] [Android SDK reference](https://docs.flowx.ai/6.x/sdks/android-renderer.md)
>
> Android renderer SDK documentation

> [card] [Migration overview](https://docs.flowx.ai/release-notes/v6.x/v6.0.0-october-2026/migrating-from-v5.9-to-v6.0/migration-overview.md)
>
> Full 5.9.x → 6.0.0 container app upgrade guide


## Related topics

- [Android SDK](https://docs.flowx.ai/6.x/sdks/android-renderer.md)
- [Renderer SDKs](https://docs.flowx.ai/release-notes/v5.x/v5.0.0-july-2025/migrating-from-v4.7.x-to-5.0/renderers.md)
- [React Native SDK](https://docs.flowx.ai/6.x/sdks/react-native-renderer.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.