Migrate Adapty Kotlin Multiplatform SDK to v4.4 (beta)

Adapty Kotlin Multiplatform SDK 4.4 is a beta release. It changes the fallback file format, requires iOS 16 for flows, and reports more flow errors to your app. To update your app to 4.4, set the SDK version to 4.4.0-beta.1, and replace both fallback files in the same build. Earlier SDK versions reject the new files. Then review the other changes in this guide.

If you’re still on 4.1, start with Migrate to v4.3 (beta) and then follow this guide.

Warning

The fallback file format changed in 4.4, and the compiler can’t detect a fallback file for SDK 4.1–4.3. Without new fallback files, every placement loses its fallback.

Quick reference

v4.3v4.4
Fallback files downloaded for 4.1–4.3New fallback file format; download both files again
Flows open on iOS 15Flows require iOS 16
An embedded flow view on iOS reports no error when its flow can’t loadIt reports the error to flowViewDidReceiveError
On Android, the SDK only logs flow script errorsThey reach flowViewDidReceiveError as AdaptyErrorCode.JS_EXCEPTION
The SDK reports AdaptyUI errors as AdaptyErrorCode.UNKNOWNIt reports them with their own codes, such as AdaptyErrorCode.PLATFORM_NOT_SUPPORTED

Installation

Update the version, and sync the project:

[versions]
adapty-kmp = "4.4.0-beta.1"

4.4 is a beta release, so set the exact version: 4.4.0-beta.1.

The requirements are unchanged: Xcode 16.2, iOS deployment target 15.0, and compileSdk 35 on Android. Flows are the exception: see Flows require iOS 16. See Install Adapty SDK for the full setup.

On Android, the SDK now adds the Adapty BOM to the compile classpath of your app. If your app locks dependencies, update the lockfile.

Replace the fallback files

To download the fallback files again, in Placements, click Fallbacks > Download iOS Fallback. In the Adapty SDK v4.4.0 and higher row, click Download. Repeat with Download Android Fallback.

The downloaded files are named ios_4_4_0_fallback.json and android_4_4_0_fallback.json. Use them in place of your fallback files for SDK 4.1–4.3, as in Use fallback paywalls:

  • iOS: Add the file to your Xcode project.
  • Android: Put the file in the assets folder of the Android fallback file for 4.1–4.3.

Give each file the name that your app passes to Adapty.setFallback, or update the names in that call.

With a fallback file for SDK 4.1–4.3, Adapty.setFallback returns an AdaptyError. To verify the new files, run the app on iOS and on Android, and make sure that this call returns no error.

Flows require iOS 16

Starting from 4.4, flows require iOS 16 or later. Other SDK features, such as purchases and custom paywalls, still work on iOS 15.

On iOS 15, createFlowView returns an AdaptyError with the AdaptyErrorCode.PLATFORM_NOT_SUPPORTED code. When your app receives this error, show your own content instead of the flow, such as a custom paywall.

Flow errors reach flowViewDidReceiveError

Starting from 4.4, the SDK reports two more flow errors to flowViewDidReceiveError:

  • Embedded flow views on iOS: When the view can’t show its flow, the result depends on the SDK and iOS versions:
    • SDK 4.4 or later, iOS 15: The view reports an error with the AdaptyErrorCode.PLATFORM_NOT_SUPPORTED code. The SDK works on iOS 15, but flows require iOS 16.
    • SDK 4.4 or later, iOS 16 or later: When the flow fails to load, the view reports the error that the AdaptyUI.createFlowView method returns for that flow.
    • SDK 4.3 or earlier: The view reports no error and shows nothing in place of the flow.
  • Flow script errors on Android: The flow script can throw an exception while it handles an SDK event. This exception reaches flowViewDidReceiveError with the AdaptyErrorCode.JS_EXCEPTION code, the same as on iOS. Before 4.4, the SDK only logged it.

Your flow error handling now runs in these cases too. If you don’t override flowViewDidReceiveError, the default implementation closes the flow on these errors. To keep the flow open on a script error, override flowViewDidReceiveError, and don’t dismiss the view for AdaptyErrorCode.JS_EXCEPTION.

AdaptyUI errors have their own codes

Before 4.4, the SDK had no codes for AdaptyUI errors, such as a flow that can’t open, and reported them as AdaptyErrorCode.UNKNOWN. Starting from 4.4, these errors have their own codes, from PLATFORM_NOT_SUPPORTED (4001) to PLATFORM_VIEW (4300). If your code matches AdaptyErrorCode.UNKNOWN to handle a flow error, match the new code instead. A when expression over AdaptyErrorCode without an else branch stops compiling: add the new codes, or an else branch.

For the full list, see Handle errors.

New in 4.4

These additions are opt-in. Your existing code keeps working without them: