Supabase has taken an important step for Android and Kotlin developers. The Kotlin Multiplatform client library, previously maintained under the community namespace, is now an official Supabase SDK maintained by the Supabase SDK team.
The first official release is version 4.0.0-alpha-1, published in December 2026. This release introduces a new Maven group and Kotlin package namespace. The underlying APIs remain largely unchanged, which makes migration from version 3.x relatively straightforward.
For Android developers, this means existing applications do not need to be rewritten. Most of the work involves updating Gradle dependencies, replacing package imports, checking configuration files, and testing the application against the new release.
This article explains how to migrate an existing Android application to the official Supabase Kotlin SDK and what to check before using it in production.
What Changed in the Official Supabase Kotlin SDK?
The Kotlin SDK was originally developed and maintained by the community. Supabase has now moved the project into its official GitHub organization and taken responsibility for maintaining the SDK.
The first official release introduces two important namespace changes:
Component | Previous version (3.x) | Official version (4.x) |
|---|
Maven group | io.github.jan-tennert.supabase | io.supabase |
Kotlin package | io.github.jan.supabase | io.supabase |
Authentication module | auth-kt | auth-kt |
Database module | postgrest-kt | postgrest-kt |
Storage module | storage-kt | storage-kt |
Realtime module | realtime-kt | realtime-kt |
Functions module | functions-kt | functions-kt |
The artifact names remain the same. The main difference is the namespace used to resolve dependencies and import classes.
Another important point is that Supabase has kept the public API compatible with version 3.9.0. Existing application logic should continue to work after updating the dependencies and imports.
The SDK also preserves previously stored authentication sessions, PKCE code verifiers, and resumable upload state. Users should not need to sign in again simply because the application moves from version 3.x to version 4.x.
However, version 4.0.0-alpha-1 is a public alpha release. Developers should consider that before upgrading applications that are already deployed to production.
Understanding the Migration Before Making Changes
Before changing the project, identify how your Android application currently communicates with Supabase.
Some applications use the Kotlin SDK for authentication and database operations. Others use direct REST API calls through Retrofit or OkHttp. There are also applications that use a combination of SDK modules and custom networking code.
The migration approach depends on the existing implementation.
Existing implementation | Recommended approach |
|---|
Supabase Kotlin SDK 3.x | Upgrade dependencies and package imports |
Supabase Kotlin SDK 2.x | Follow the 2.x-to-3.x migration first, then upgrade to 4.x |
Retrofit or OkHttp REST integration | Introduce the Kotlin SDK gradually |
Custom authentication implementation | Review session handling and authentication flows before migrating |
Kotlin Multiplatform application | Update dependencies and imports in all relevant source sets |
If your application already uses version 3.x, the migration is mostly a namespace update. If it uses direct HTTP requests, migrating to the SDK is a larger architectural change because you will be replacing parts of your networking and authentication implementation.
For this walkthrough, assume an existing Android application already uses Supabase Kotlin SDK 3.9.0.
Updating Gradle Dependencies
The first step is to update the dependencies in the application module.
Previously, a project using Supabase authentication and database operations might have the following configuration:
dependencies {
implementation(
platform(
"io.github.jan-tennert.supabase:bom:3.9.0"
)
)
implementation(
"io.github.jan-tennert.supabase:auth-kt"
)
implementation(
"io.github.jan-tennert.supabase:postgrest-kt"
)
}
The official SDK uses the new io.supabase Maven group.
Update the dependencies as follows:
dependencies {
implementation(
platform("io.supabase:bom:4.0.0-alpha-1")
)
implementation("io.supabase:auth-kt")
implementation("io.supabase:postgrest-kt")
implementation("io.supabase:storage-kt")
implementation("io.supabase:realtime-kt")
}
You do not need to add every module. Include only the functionality your application uses.
For example, an application that only performs authentication and database operations needs the authentication and PostgREST modules. An application that uploads images can also include Storage.
The Bill of Materials (BOM) keeps the versions of the Supabase modules aligned. This is particularly useful when an application uses multiple SDK features.
Add the required Ktor client engine
The Supabase Kotlin SDK uses Ktor for HTTP communication. Version 4 uses Ktor 3, so the application must use a compatible Ktor 3 client engine.
For an Android application, an example dependency is:
dependencies {
implementation(
platform("io.supabase:bom:4.0.0-alpha-1")
)
implementation("io.supabase:auth-kt")
implementation("io.supabase:postgrest-kt")
implementation("io.ktor:ktor-client-android:3.6.1")
}
The Ktor version should be compatible with the SDK release and the rest of your application dependencies. Avoid mixing Ktor 2 and Ktor 3 modules.
If your application uses Realtime, verify that the selected Ktor engine supports WebSockets. A normal HTTP request may work while Realtime connections fail if the engine does not provide the required functionality.
Enable Kotlin serialization
The SDK uses KotlinX Serialization by default. Add the serialization compiler plugin using the same Kotlin version as the application:
plugins {
id("org.jetbrains.kotlin.plugin.serialization") version "YOUR_KOTLIN_VERSION"
}
If the project already uses this plugin, you do not need to add it again. Just make sure its version matches the Kotlin compiler version.
The SDK documentation also describes alternatives such as Moshi and Jackson for applications that require a different serialization approach.
Updating Package Imports
After updating Gradle dependencies, the next step is to replace the old package names.
For example, an existing import might look like this:
import io.github.jan.supabase.createSupabaseClient
import io.github.jan.supabase.auth.Auth
import io.github.jan.supabase.postgrest.Postgrest
The new imports use the official namespace:
import io.supabase.createSupabaseClient
import io.supabase.auth.Auth
import io.supabase.postgrest.Postgrest
The same replacement applies to other SDK modules and their subpackages.
Android Studio provides a convenient way to perform this update:
Open the Android project.
Select Edit and then Find and Replace in Files.
Search for io.github.jan-tennert.supabase and replace it with io.supabase.
Search for io.github.jan.supabase and replace it with io.supabase.
Review the changes before applying them to the entire project.
Rebuild the application and resolve any remaining compilation errors.
You can also use a command-line replacement on macOS or Linux:
grep -rlE --null \
'io\.github\.jan(-tennert)?\.supabase' \
--include='*.kt' \
--include='*.kts' \
--include='*.gradle' \
--include='*.java' \
--include='*.toml' \
--include='*.properties' \
--include='*.xml' \
--include='*.pro' \
. | xargs -0 perl -pi -e \
's/io\.github\.jan-tennert\.supabase/io.supabase/g; s/io\.github\.jan\.supabase/io.supabase/g'
Run this command from the project root and review the resulting changes. Keep a Git commit or backup before performing a large replacement.
Initializing the Supabase Client
The client initialization approach remains familiar in version 4. You create a Supabase client and install the modules that your application needs.
A useful Android project structure is to keep the client in a dedicated configuration or data layer rather than creating a new instance inside every Activity or ViewModel.
For example, create a SupabaseClientProvider:
package com.example.app.data
import io.supabase.createSupabaseClient
import io.supabase.auth.Auth
import io.supabase.postgrest.Postgrest
import io.supabase.storage.Storage
object SupabaseClientProvider {
private const val SUPABASE_URL =
"https://your-project.supabase.co"
private const val SUPABASE_KEY =
"YOUR_PUBLISHABLE_KEY"
val client = createSupabaseClient(
supabaseUrl = SUPABASE_URL,
supabaseKey = SUPABASE_KEY
) {
install(Auth)
install(Postgrest)
install(Storage)
}
}
The example installs three modules:
Auth provides user registration, sign-in, session management, and other authentication features.
PostgREST provides access to database tables and views through the Supabase Data API.
Storage provides file upload, download, and bucket management functionality.
You can install Realtime or Functions in the same configuration when the application requires them.
The example uses placeholder credentials. In a real application, load the project URL and publishable key through an appropriate build configuration rather than committing them directly to source control.
A publishable key is designed for use in client applications. It does not replace database security. Never include a service role key in an Android application because application packages can be inspected and their contents extracted.
Migrating Database Operations
One of the main advantages of using the Kotlin SDK is that developers can interact with Supabase database tables using Kotlin rather than manually constructing HTTP requests.
Consider an application that retrieves a list of products from a Supabase table named products.
A simple model can look like this:
import kotlinx.serialization.Serializable
@Serializable
data class Product(
val id: Int,
val name: String,
val price: Double
)
You can retrieve the records using the PostgREST module:
import com.example.app.data.SupabaseClientProvider
import io.supabase.postgrest.from
suspend fun getProducts(): List<Product> {
val response = SupabaseClientProvider.client
.from("products")
.select()
.decodeList<Product>()
return response
}
The query retrieves records from the products table and converts the response into a list of Product objects.
The suspend function can be called from a ViewModel using a coroutine.
class ProductViewModel : ViewModel() {
private val _products =
MutableStateFlow<List<Product>>(emptyList())
val products: StateFlow<List<Product>> = _products
fun loadProducts() {
viewModelScope.launch {
try {
_products.value = getProducts()
} catch (exception: Exception) {
// Handle the error
}
}
}
}
This keeps database operations away from the UI layer and makes the application easier to maintain.
When migrating existing database code, check the following areas:
Table names and database schema.
Kotlin serialization annotations.
Nullable fields and database column types.
Filtering and sorting conditions.
Pagination and response decoding.
Row Level Security policies.
The SDK can simplify database access, but it does not automatically make an existing database query secure. Database permissions and policies remain important.
Migrating Authentication and User Sessions
Authentication is another important area to test during migration.
If your application already uses the Supabase Auth module, most authentication calls should remain compatible after updating the package imports.
For example, a password-based sign-in operation can use the Auth module:
import io.supabase.auth.Auth
import io.supabase.auth.providers.builtin.Email
suspend fun signIn(
email: String,
password: String
) {
SupabaseClientProvider.client.auth.signInWith(
Email
) {
this.email = email
this.password = password
}
}
The SDK manages authentication sessions and supports automatic session refresh. Applications should still handle authentication failures, expired sessions, and sign-out events correctly.
What happens to existing sessions?
One concern during an SDK upgrade is whether users will lose their login sessions.
According to the official migration documentation, version 4 can read the session information and other relevant state stored by version 3. This includes PKCE code verifiers and resumable upload state.
That means users should remain signed in after the application update, provided the existing session is valid and the application continues to use compatible authentication configuration.
Even so, test the following scenarios before releasing the updated application:
Existing user opens the updated application.
Access token expires and needs refreshing.
User signs out and signs in again.
Application is closed and reopened.
OAuth or email deep links return to the application.
Network connectivity is lost during authentication.
Review OAuth deep links
If your application uses Google or another OAuth provider, review the Android deep-link configuration.
The SDK supports handling authentication redirects through the application intent.
For example:
override fun onCreate(
savedInstanceState: Bundle?
) {
super.onCreate(savedInstanceState)
SupabaseClientProvider.client
.handleDeeplinks(intent)
}
The application must also register the appropriate URL scheme and host in its Android manifest and configure the matching redirect URL in the Supabase dashboard.
For OAuth and PKCE authentication, test the complete browser-to-application redirect flow. A successful sign-in request alone does not confirm that the application can receive and process the callback correctly.
Reviewing Configuration Files Beyond Kotlin Code
A common migration mistake is updating Kotlin imports but forgetting other files that contain the previous package name.
The compiler cannot detect every outdated reference. Some configuration problems may only appear when building a release version of the application.
Pay particular attention to the following files.
ProGuard and R8 rules
An existing project may contain rules such as:
-keep class io.github.jan.supabase.** { *; }
Update the package reference:
-keep class io.supabase.** { *; }
Review the actual rules used by your application rather than blindly replacing every keep rule. The goal is to ensure that rules referring to SDK classes match the new namespace.
AndroidManifest.xml
Some applications override SDK initializers through manifest entries.
For example, an existing manifest may contain a reference to an initializer under the old package name. These references must be updated to the corresponding io.supabase package.
The new initializer names include:
io.supabase.auth.SupabaseInitializer
io.supabase.storage.SupabaseInitializer
If the application removes or overrides SDK initializers through manifest-merger instructions, check those entries carefully.
Gradle configuration
Review all dependency declarations, including version catalogs such as libs.versions.toml, shared Gradle configuration, and module-specific build files.
Also check compiler opt-ins that reference SDK annotations. These can continue to exist without causing an immediate compilation failure.
Finally, search the complete project for io.github.jan. Any remaining reference should be investigated.
Common Migration Problems and How to Fix Them
Most migration problems come from mixing old and new dependencies or overlooking configuration files.
Problem | Possible cause | Recommended fix |
|---|
Unresolved reference | Old Kotlin imports remain | Replace the old package namespace |
Gradle dependency conflict | A plugin still uses SDK 3.x | Upgrade the plugin to a version compatible with 4.x |
Missing Ktor classes | Incorrect or missing Ktor engine | Add a compatible Ktor 3 client engine |
Realtime connection fails | Selected engine lacks WebSocket support | Use a WebSocket-compatible Ktor engine |
Release build crashes | Outdated R8 or ProGuard rules | Update package references in shrinker rules |
OAuth callback fails | Deep-link configuration is incorrect | Review manifest and Supabase redirect URLs |
Database request returns an error | Incorrect permissions or RLS policy | Review Data API access and database policies |
Handling Gradle dependency conflicts
The SDK uses Gradle module capabilities to prevent incompatible 3.x and 4.x modules from being included together.
For example, your application may use the new SDK while an older third-party plugin still depends on the previous Maven group.
Gradle can report an error similar to:
Cannot select module because of conflict
Do not try to solve this by randomly excluding dependencies. First identify which library still depends on the older SDK.
You can inspect the dependency tree with:
./gradlew :app:dependencies
On macOS or Linux, filter the output for the previous Maven group:
./gradlew :app:dependencies \
| grep io.github.jan-tennert.supabase
Upgrade the dependency that brings in the old SDK to a version built against version 4. If no compatible version exists, you may need to wait for the library maintainer to release one or temporarily postpone the migration.
Advantages and Disadvantages of Migrating
The official SDK transition provides several benefits, but developers should also consider the current alpha status.
Advantages | Disadvantages and considerations |
|---|
Maintained by the Supabase SDK team | The first official release is still alpha |
Official Maven and package namespace | Existing imports and dependencies need updating |
Existing public API remains compatible with 3.9.0 | Third-party plugins may need separate upgrades |
Existing sessions and stored state are preserved | Configuration references may be missed by the compiler |
Same module structure and artifact names | Teams must test release builds and authentication flows |
For applications already using version 3.x, the migration is relatively small. However, an alpha release is not automatically the right choice for every production application.
Teams should evaluate the release status, test compatibility with their existing dependencies, and decide whether to adopt the alpha now or continue using the stable 3.x release until version 4 reaches a stable release.
Best Practices for a Safe Android Migration
A controlled migration is better than updating every dependency and configuration file at once.
Consider the following practices:
Create a separate Git branch for the migration. This makes it easier to compare changes and roll back if necessary.
Update all Supabase modules and plugins together. Avoid mixing SDK 3.x and 4.x dependencies.
Use the Supabase BOM to manage module versions consistently.
Keep the Supabase client in a shared application or data layer instead of initializing multiple clients across Activities.
Review R8 rules, manifest overrides, reflection, and compiler opt-ins.
Test authentication session restoration using an account that was already signed in before the update.
Verify database permissions and Row Level Security policies independently of the SDK migration.
Test both debug and minified release builds.
Monitor application logs and network failures after deployment.
Keep a rollback option available until the updated version has been validated.
For production applications, pay special attention to authentication, database access, and file uploads. These features can appear to work in a debug build but fail under different network conditions or release configurations.
Conclusion
The official Supabase Kotlin SDK is an important development for Android and Kotlin developers. With version 4, Supabase has moved the existing community-built library into its official SDK organization and introduced the io.supabase Maven group and package namespace.
The migration from version 3.x is relatively straightforward because the artifact names and public APIs remain compatible. Developers mainly need to update Gradle dependencies, replace imports, check configuration files, and verify third-party library compatibility.
The most important areas to test are authentication session restoration, OAuth deep links, database access, Ktor compatibility, and release-build configuration.
Since the first official release is currently an alpha, teams should evaluate its stability before adopting it in production. For applications already using the Kotlin SDK, however, understanding these migration steps will make the transition much easier when moving to the official Supabase release.
Join the conversation! Your thoughts help the community grow.