Fixing Isar + Gradle 8/Kotlin DSL Build Errors

By Engineering Team•October 11, 2026•3 min read

Why Isar Instead of Hive

Both are local NoSQL stores for Flutter, but they target different problems:

Hive Isar
Setup Minimal — open a box and start writing, like a Map More involved — requires @Collection schemas and code generation
Transactions Not fully ACID — an interrupted write can leave the box file partially written ACID-compliant — a failed background sync rolls back cleanly instead of leaving corrupt cached data
Memory Loads the entire box into RAM Only loads the objects actually queried
Updates Rewrites the whole box to disk on each write Performs delta updates — only the changed part of the file is touched

For a cache-then-network screen (serve cached data instantly, revalidate against the API in the background, then push the fresh result into the UI reactively), Isar’s ACID guarantees and partial-update behavior matter more than Hive’s lower setup cost — a corrupted cache from an interrupted background sync is a worse failure mode than a few extra lines of schema boilerplate.

The Build Problem

isar_flutter_libs predates Gradle’s Kotlin DSL (build.gradle.kts) becoming Flutter’s default project template, and its native Android plugin doesn’t declare a namespace — something Android Gradle Plugin (AGP) 8+ requires of every subproject. Left unfixed, the build fails with a missing-namespace error specifically on isar_flutter_libs, not on your own app module.

The Fix

1. Confirm the Gradle Wrapper Version

android/gradle/wrapper/gradle-wrapper.properties needs a Gradle version recent enough to pair with a modern AGP — at least gradle-8.14-all.zip.

2. Patch the Missing Namespace

Add this to the bottom of android/build.gradle.kts, outside any existing block:

// isar_flutter_libs ships with no namespace declared; AGP 8+ requires one on every subproject.
subprojects {
    plugins.withType<com.android.build.gradle.api.AndroidBasePlugin> {
        val android = extensions.getByType<com.android.build.gradle.BaseExtension>()
        if (android.namespace == null) {
            android.namespace = "dev.isar.isar_flutter_libs"
        }
    }
}

3. Enable AndroidX + Jetifier

Isar’s native wrappers still reference older support-library symbols, so android/gradle.properties needs:

android.useAndroidX=true
android.enableJetifier=true

4. Set minSdk to 21

Isar’s native .so binaries won’t load on-device below API 21. In android/app/build.gradle.kts:

defaultConfig {
    minSdk = 21   // required for Isar's native binaries — the Flutter default (16/19) is too low
    targetSdk = 34
}

Leaving minSdk at Flutter’s lower default compiles fine but fails at runtime on an actual device, which makes this one easy to miss until you’re well past the build step.