Update the Kotlin API client
This is documentation for v2 of the Kotlin API clients, which is not the latest version. To see the documentation for the latest version, see Kotlin v3.
You should keep your Kotlin API client up to date to benefit from improvements and bug fixes.
The ‘Kotlin’ API client follows Semantic Versioning.
Update to v2
Version 2.x
of the library uses ktor client version 2.x
. To migrate from 1.x
to 2.x
, follow these steps:
Ktor
Refer to Ktor’s migration guide.
LogLevel
The library uses its own LogLevel
instead of ktor’s Loglevel
.
Update your imports:
Subsystem | 1.x | 2.x |
---|---|---|
LogLevel | io.ktor.client.features.logging.LogLevel |
com.algolia.search.logging.LogLevel |
Public constants
Constants like KeyIndexName
, KeyEnglish
, and RouteIndexesV1
) aren’t exposed anymore. Use your own
constants instead.
You can find the internal constants in the package:
com.algolia.search.serialize.internal
.
This new version removes all deprecated methods and features from v1.
Update with Android Studio or IntelliJ Idea
Go to your build.gradle
or build.gradle.kts
file and synchronize it.
Check the line for com.algolia:algoliasearch-client-kotlin
: if you see the warning "a newer version com.algolia:algoliasearch-client-kotlin than X is available: Y", you can replace X by Y and re-build your project.
Update without Android Studio or IntelliJ Idea
Go to the latest release on GitHub and note its release number, for example, X.Y.Z
.
Go to your build.gradle
or build.gradle.kts
file, find the line with com.algolia:algoliasearch-client-kotlin
, replace its version by X.Y.Z
and build your project to upgrade.