I am trying to use Object Library.
I read the official documentation and follow the instructions. But still, it not working.
The problem is when I try to initialize boxStore object I don't find MyObjectBox class.
val boxStore = MyObjectBox.builder().androidContext(this).build()
Here is my app module. build.gradle (app module)
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'io.objectbox'
android {
compileSdkVersion 26
defaultConfig {
....
}
buildTypes {
release {
....
}
}
sourceSets {
main.java.srcDirs += 'src/main/java'
}
}
kapt {
generateStubs = true
arguments {
arg("objectbox.debug", true)
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
... other dependencies
//object box
implementation "io.objectbox:objectbox-android:$objectboxVersion"
// some useful Kotlin extension functions
implementation "io.objectbox:objectbox-kotlin:$objectboxVersion"
kapt "io.objectbox:objectbox-processor:$objectboxVersion"
}
And Here is my project module: build.gradle (project)
buildscript {
ext.kotlin_version = '1.2.10'
//all version
ext.support_version = '26.1.0'
ext.objectboxVersion = '1.3.3'
repositories {
google()
jcenter()
maven { url "http://objectbox.net/beta-repo/" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
//object box
classpath "io.objectbox:objectbox-gradle-plugin:$objectboxVersion"
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://maven.google.com' }
maven { url "http://objectbox.net/beta-repo/" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I am searching for the possible solution in several projects. I also follow the official demo app. But still, it not working for me?
Can anyone help me to fix this?
apply plugin: 'kotlin-kapt'
call as it generates the required assets. – Larcener