AGP9+ MyObjectbox is not generating. · Issue #1236 · objectbox/objectbox-java · GitHub
Skip to content

AGP9+ MyObjectbox is not generating. #1236

@falgunb-up

Description

@falgunb-up

Is there an existing issue?

Build info

  • ObjectBox version: 5.4.1
  • OS: Windows 11
  • Device/ABI/architecture: Android (minSdk 28, targetSdk 36)

Steps to reproduce

  1. Create an Android project with AGP 9.1.1, Gradle 9.3.1, Kotlin 2.2.10
  2. Add ObjectBox via buildscript classpath in root build.gradle.kts and apply id("io.objectbox") in the app module
  3. Annotate a Kotlin data class with @Entity and @Id
  4. Sync Gradle and build the project

Expected behavior

MyObjectBox is generated in build/generated/source/objectbox/ and is importable as com.package.name.MyObjectBox.

Actual behavior

MyObjectBox is never generated. No objectbox-models/default.json schema file is created either. The build completes without errors but the code generation step does not run.

Code

Code
// root build.gradle.kts
buildscript {
    dependencies {
        classpath("io.objectbox:objectbox-gradle-plugin:5.4.1")
    }
}

plugins {
    alias(libs.plugins.android.application) apply false
    alias(libs.plugins.kotlin.compose) apply false
    alias(libs.plugins.hilt) apply false
    alias(libs.plugins.ksp) apply false
    alias(libs.plugins.kotlin.serialization) apply false
}
// app/build.gradle.kts
plugins {
    alias(libs.plugins.android.application)
    alias(libs.plugins.kotlin.compose)
    alias(libs.plugins.hilt)
    alias(libs.plugins.ksp)
    alias(libs.plugins.kotlin.serialization)
    id("io.objectbox")
}

android {
    namespace = "name_space"
    compileSdk {
        version = release(36) { minorApiLevel = 1 }
    }
    defaultConfig {
        applicationId = "app_id"
        minSdk = 28
        targetSdk = 36
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_17
        targetCompatibility = JavaVersion.VERSION_17
    }
}
// settings.gradle.kts
pluginManagement {
    repositories {
        google {
            content {
                includeGroupByRegex("com\\.android.*")
                includeGroupByRegex("com\\.google.*")
                includeGroupByRegex("androidx.*")
            }
        }
        mavenCentral()
        gradlePluginPortal()
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
    }
}
# gradle/libs.versions.toml
[versions]
agp = "9.1.1"
kotlin = "2.2.10"
ksp = "2.2.10-2.0.2"
// UserEntity.kt
@Entity
data class UserEntity(
    @Id var id: Long = 0,
     .
     .
)
</details>
Logs, stack traces
<details><summary>Logs</summary>
</details>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions