ObjectBox is a superfast lightweight database for objects

Overview

Follow ObjectBox on Twitter

ObjectBox Java (Kotlin, Android)

ObjectBox is a superfast object-oriented database with strong relation support. ObjectBox is embedded into your Android, Linux, macOS, or Windows app.

Latest version: 2.9.1 (2021/03/15)

Demo code using ObjectBox:

Playlist playlist = new Playlist("My Favorites");
playlist.songs.add(new Song("Lalala"));
playlist.songs.add(new Song("Lololo"));
box.put(playlist);

Other languages/bindings

ObjectBox supports multiple platforms and languages. Besides JVM based languages like Java and Kotlin, ObjectBox also offers:

Gradle setup

Add this to your root build.gradle (project level):

buildscript {
    ext.objectboxVersion = '2.9.1'
    dependencies {
        classpath "io.objectbox:objectbox-gradle-plugin:$objectboxVersion"
    }
}

And this to our app's build.gradle (module level):

apply plugin: 'io.objectbox' // after applying Android plugin

First steps

Create data object class @Entity, for example "Playlist".

@Entity public class Playlist { ... }

Now build the project to let ObjectBox generate the class MyObjectBox for you.

Prepare the BoxStore object once for your app, e.g. in onCreate in your Application class:

boxStore = MyObjectBox.builder().androidContext(this).build();

Then get a Box class for the Playlist entity class:

Box<Playlist> box = boxStore.boxFor(Playlist.class);

The Box object gives you access to all major functions, like put, get, remove, and query.

For details please check the docs.

Links

Features

Docs & Changelog, JavaDocs

Examples

We love to get your feedback

Let us know how we are doing: 2 minute questionnaire. Thanks!

Also, we want to hear about your app! It will - literally - take just a minute, but help us a lot. Thank you!​ 🙏

License

Copyright 2017-2020 ObjectBox Ltd. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Comments
  • Crash on ObjectBox initialization. java.lang.UnsatisfiedLinkError

    Crash on ObjectBox initialization. java.lang.UnsatisfiedLinkError

    Issue Basics

    App crashes when we initialize ObjectBox

    • ObjectBox version (are using the latest version?): 2.1.0
    • Reproducibility: occurs on some user devices, we could not reproduce it

    Reproducing the bug

    Description

    We initialize the BoxStore on app start when initializing a Dagger graph. And some users experience crash from the start. Just logs in Crashlytics

    Code

    BoxStore boxStore = MyObjectBox.builder()
            .androidContext(appContext)
            .name("db_v2")
            .build();
        if (BuildConfig.DEBUG) {
          new AndroidObjectBrowser(boxStore).start(appContext);
        }
        return boxStore;
    

    Logs & stackstraces

    > Fatal Exception: java.lang.UnsatisfiedLinkError
    > dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.vyng.android-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]] couldn't find "libobjectbox.so"
    
    > Fatal Exception: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.vyng.android-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]] couldn't find "libobjectbox.so"
    >        at java.lang.Runtime.loadLibrary(Runtime.java:366)
    >        at java.lang.System.loadLibrary(System.java:988)
    >        at io.objectbox.internal.NativeLibraryLoader.(NativeLibraryLoader.java:71)
    >        at io.objectbox.BoxStore.(BoxStore.java:189)
    >        at io.objectbox.BoxStoreBuilder.build(BoxStoreBuilder.java:352)
    >        at com.vyng.android.di.modules.AppModule.boxStore(AppModule.java:95)
    >        at com.vyng.android.di.modules.AppModule_BoxStoreFactory.proxyBoxStore(AppModule_BoxStoreFactory.java:34)
    >        at com.vyng.android.di.modules.AppModule_BoxStoreFactory.provideInstance(AppModule_BoxStoreFactory.java:25)
    >        at com.vyng.android.di.modules.AppModule_BoxStoreFactory.get(AppModule_BoxStoreFactory.java:21)
    >        at com.vyng.android.di.modules.AppModule_BoxStoreFactory.get(AppModule_BoxStoreFactory.java:8)
    >        at dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
    >        at com.vyng.android.di.modules.AppModule_ChannelDataRepositoryFactory.provideInstance(AppModule_ChannelDataRepositoryFactory.java:152)
    >        at com.vyng.android.di.modules.AppModule_ChannelDataRepositoryFactory.get(AppModule_ChannelDataRepositoryFactory.java:109)
    >        at com.vyng.android.di.modules.AppModule_ChannelDataRepositoryFactory.get(AppModule_ChannelDataRepositoryFactory.java:26)
    >        at dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
    >        at com.vyng.android.video.cache.di.CacheModule_CacheWatcherFactory.provideInstance(CacheModule_CacheWatcherFactory.java:80)
    >        at com.vyng.android.video.cache.di.CacheModule_CacheWatcherFactory.get(CacheModule_CacheWatcherFactory.java:58)
    >        at com.vyng.android.video.cache.di.CacheModule_CacheWatcherFactory.get(CacheModule_CacheWatcherFactory.java:16)
    >        at dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
    >        at com.vyng.android.di.components.DaggerAppComponent.injectVyngApplication(DaggerAppComponent.java:1632)
    >        at com.vyng.android.di.components.DaggerAppComponent.inject(DaggerAppComponent.java:1427)
    >        at com.vyng.android.VyngApplication.initAppComponent(VyngApplication.java:343)
    >        at com.vyng.android.VyngApplication.onCreate(VyngApplication.java:137)
    >        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1012)
    >        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4631)
    >        at android.app.ActivityThread.access$1500(ActivityThread.java:151)
    >        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1374)
    >        at android.os.Handler.dispatchMessage(Handler.java:102)
    >        at android.os.Looper.loop(Looper.java:135)
    >        at android.app.ActivityThread.main(ActivityThread.java:5348)
    >        at java.lang.reflect.Method.invoke(Method.java)
    >        at java.lang.reflect.Method.invoke(Method.java:372)
    >        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:947)
    >        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:742)
    

    Entities

    Not relevant.

    Misc

    A screenshot from Crashlytics with device manufacturers and OS versions: https://ibb.co/hb3SSq

    bug 
    opened by Gaket 86
  • @Unique: replace on conflict flag

    @Unique: replace on conflict flag

    Right now, @Unique throws an exception if there's a violation.

    We could also offer to replace old entities with newer ones, e.g. by doing a @Unique(replaceOnConflict = true).

    Keep in mind: If there are multiple unique properties, on entity might replace several others.

    enhancement 
    opened by greenrobot 64
  • Improve Kotlin support

    Improve Kotlin support

    Right now entities must be defined in Java. This is because the ObjectBox Gradle plugin uses JDT to parse and modify Java code.

    Possible options:

    • Find (wait for) a Kotlin AST library like JDT
    • (Also) support plain annotation processing with its limitations (no modifications of existing sources)
    • ?
    enhancement 
    opened by greenrobot 56
  • Crash: Java_io_objectbox_query_Query_nativeFind

    Crash: Java_io_objectbox_query_Query_nativeFind

    Issue Basics

    • ObjectBox version (are using the latest version?): 1.5.0
    • Reproducibility: Not always

    I received the following crash when I called box.find method. This only happened sometimes. But once it happened, it would always happen later. Any clue ?

    *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    Build fingerprint: 'samsung/starltexx/starlte:8.0.0/R16NW/G960FXXU1BRE6:user/release-keys'
    Revision: '26'
    ABI: 'arm'
    pid: 763, tid: 916, name: MyHandlerThread  >>> com.something <<<
    signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x83804403
        r0 83804403  r1 00000036  r2 b7c957ac  r3 c1be0c93
        r4 b7c957ac  r5 bada9e78  r6 b7b57534  r7 bbdfd468
        r8 bc0a5488  r9 bc0a5480  sl 000003e8  fp bc0a5480
        ip e5826d5c  sp bbdfd458  lr c1bd7437  pc c1be0cb0  cpsr a0070030
    backtrace:
        #00 pc 00051cb0  /data/app/com.something-v37ezjtrI-iGSmyORUO3eQ==/lib/arm/libobjectbox.so
        #01 pc 00048435  /data/app/com.something-v37ezjtrI-iGSmyORUO3eQ==/lib/arm/libobjectbox.so
        #02 pc 0004acd9  /data/app/com.something-v37ezjtrI-iGSmyORUO3eQ==/lib/arm/libobjectbox.so
        #03 pc 0004aea7  /data/app/com.something-v37ezjtrI-iGSmyORUO3eQ==/lib/arm/libobjectbox.so
        #04 pc 00047feb  /data/app/com.something-v37ezjtrI-iGSmyORUO3eQ==/lib/arm/libobjectbox.so
        #05 pc 0007d33d  /data/app/com.something-v37ezjtrI-iGSmyORUO3eQ==/lib/arm/libobjectbox.so (Java_io_objectbox_query_Query_nativeFind+72)
        #06 pc 000fa21d  /data/app/com.something-v37ezjtrI-iGSmyORUO3eQ==/oat/arm/base.odex (offset 0x38000)
    
    bug 
    opened by LeeKingHung 35
  • SIGSEGV when multiple instance of app are starting

    SIGSEGV when multiple instance of app are starting

    Issue Basics

    • ObjectBox version (are using the latest version?): 1.5.0
    • Reproducibility: always

    Reproducing the bug

    Description

    I have one app and want to start multiple instances of that app on the same machine from different directories with different databases (databases stored in the same directory as the .jar file).

    Directories structure:

    parentDir/firstDir
    ------app.jar 
    ------data.mdb
    ------lock.mdb
    
    parentDir/secondDir
    ------app.jar 
    ------data.mdb
    ------lock.mdb
    

    One instance at a time is working fine. When I'm starting second instance I'm getting SIGSEGV on the first instance, second instance keeps working. Instances are identical except the data inside DB (but DB structure is the same of course).

    Important thing: crash happens only if use the same starting directory (parentDir in that example). So in one terminal I do

    cd parentDir; java -jar firstDir/app.jar
    

    In another terminal I do

    cd parentDir; java -jar secondDir/app.jar
    

    I do this because Gradle has different configurations and it builds my app into different places. For me its easy to use structure like this.

    Code

    SIGSEGV happens when this code executed:

    orderBox.put(order)
    

    So before that code I open database and retrieve some objects from it. App starts working. Then I'm starting second instance and app crashes at that place I mentioned.

    Logs & stackstraces

    Current thread (0x00007fef1425f800): JavaThread "MyThreadName" [_thread_in_native, id=19647, stack(0x00007fef1a0ef000,0x00007fef1a1f0000)]

    siginfo: si_signo: 11 (SIGSEGV), si_code: 1 (SEGV_MAPERR), si_addr: 0x000000000000bd36

    Registers: ... ... Instructions: (pc=0x000000000000bd36) 0x000000000000bd16:
    [error occurred during error reporting (printing registers, top of stack, instructions near pc), id 0xb]

    Register to memory mapping:

    RAX= [error occurred during error reporting (printing register info), id 0xb]

    Stack: [0x00007fef1a0ef000,0x00007fef1a1f0000], sp=0x00007fef1a1ee598, free space=1021k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C 0x000000000000bd36 j io.objectbox.BoxStore.beginTx()Lio/objectbox/Transaction;+45 j io.objectbox.Box.getWriter()Lio/objectbox/Cursor;+15 j io.objectbox.Box.put(Ljava/lang/Object;)J+1 j myMethod...

    Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j io.objectbox.BoxStore.nativeBeginTx(J)J+0 j io.objectbox.BoxStore.beginTx()Lio/objectbox/Transaction;+45 j io.objectbox.Box.getWriter()Lio/objectbox/Cursor;+15 j io.objectbox.Box.put(Ljava/lang/Object;)J+1 j myMethod...

    As a workaround of this issue I can launch the app like this:

    cd parentDir/firstDir; java -jar app.jar
    

    In another terminal:

    cd parentDir/secondDir; java -jar app.jar
    

    @greenrobot @greenrobot-team Can you reproduce it on your side?

    opened by avently 29
  • question about logs

    question about logs

    i have too many this logs from my app, is it normal or something is wrong ?

    W/Box: Skipping low-level close for read-only cursor (non-creator thread)
    W/Box: Destroyed recycled transaction from non-owner thread
    
    bug 
    opened by DJafari 29
  • Random crash while database inserts

    Random crash while database inserts

    While testing i have noticed a crash

    Device: Nexus 6p Android 7.1.2

    I got this crash while inserting entities to the database in an background thread.

    02-28 11:43:24.902 11071-11221/my.package.name A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x7304a4dffe in tid 11221 (AsyncTask #1)
                                                                    
                                                                    [ 02-28 11:43:24.913   382:  382 W/         ]
                                                                    debuggerd: handling request: pid=11071 uid=10300 gid=10300 tid=11221
    02-28 11:43:24.991 11246-11246/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    02-28 11:43:24.992 11246-11246/? A/DEBUG: Build fingerprint: 'google/angler/angler:7.1.2/.../...:user/release-keys'
    02-28 11:43:24.992 11246-11246/? A/DEBUG: Revision: '0'
    02-28 11:43:24.992 11246-11246/? A/DEBUG: ABI: 'arm64'
    02-28 11:43:24.992 11246-11246/? A/DEBUG: pid: 11071, tid: 11221, name: AsyncTask #1  >>> my.package.name <<<
    02-28 11:43:24.992 11246-11246/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x7304a4dffe
    02-28 11:43:24.992 11246-11246/? A/DEBUG:     x0   0000000000000001  x1   0000007204a5a0e6  x2   0000000000000000  x3   0000000000000011
    02-28 11:43:24.992 11246-11246/? A/DEBUG:     x4   0000000000000000  x5   000000000000011d  x6   0000007205f59994  x7   0000000000000000
    02-28 11:43:24.992 11246-11246/? A/DEBUG:     x8   0000007304a4dfee  x9   0000000000000000  x10  0000000000000001  x11  000000000000000c
    02-28 11:43:24.992 11246-11246/? A/DEBUG:     x12  0000007202db6e40  x13  0000000000000004  x14  000000721f6a9984  x15  0000000000000000
    02-28 11:43:24.992 11246-11246/? A/DEBUG:     x16  0000007204ce5398  x17  0000007223331800  x18  000000000000003e  x19  0000007202824b38
    02-28 11:43:24.992 11246-11246/? A/DEBUG:     x20  0000000000000011  x21  0000000000000000  x22  000000721808d080  x23  0000007204a5a0de
    02-28 11:43:24.992 11246-11246/? A/DEBUG:     x24  0000000000000000  x25  0bc1a9fd9bd644c0  x26  0000007204a4e000  x27  000000007ffffff8
    02-28 11:43:24.992 11246-11246/? A/DEBUG:     x28  0000007203f04000  x29  00000071ff328ac0  x30  0000007204c41c04
    02-28 11:43:24.992 11246-11246/? A/DEBUG:     sp   00000071ff328a50  pc   0000007204c41c34  pstate 00000000a0000000
    02-28 11:43:24.997 11246-11246/? A/DEBUG: backtrace:
    02-28 11:43:24.997 11246-11246/? A/DEBUG:     #00 pc 000000000009ec34  /data/app/my.package.name-1/lib/arm64/libobjectbox.so
    02-28 11:43:24.997 11246-11246/? A/DEBUG:     #01 pc 000000000009f37c  /data/app/my.package.name-1/lib/arm64/libobjectbox.so (mdb_cursor_get+200)
    02-28 11:43:24.997 11246-11246/? A/DEBUG:     #02 pc 000000000004c6ac  /data/app/my.package.name-1/lib/arm64/libobjectbox.so (_ZN9objectbox11IndexCursor13findIdsScalarImEEmT_PNSt6__ndk16vectorImNS3_9allocatorImEEEE+120)
    02-28 11:43:24.997 11246-11246/? A/DEBUG:     #03 pc 0000000000049950  /data/app/my.package.name-1/lib/arm64/libobjectbox.so (_ZN9objectbox6Cursor16findBacklinkKeysEPNS_8PropertyEmRNSt6__ndk16vectorImNS3_9allocatorImEEEE+124)
    02-28 11:43:24.997 11246-11246/? A/DEBUG:     #04 pc 00000000000abb08  /data/app/my.package.name-1/lib/arm64/libobjectbox.so (Java_io_objectbox_Cursor_nativeGetBacklinkEntities+144)
    02-28 11:43:24.997 11246-11246/? A/DEBUG:     #05 pc 00000000009f05dc  /data/app/my.package.name-1/oat/arm64/base.odex (offset 0x999000)
    02-28 11:43:26.468 412-412/? E/lowmemorykiller: Error writing /proc/11071/oom_score_adj; errno=22
                                                    
                                                    [ 02-28 11:43:26.469   382:  382 W/         ]
                                                    debuggerd: resuming target 11071
    02-28 11:43:26.513 928-3514/? E/InputDispatcher: channel 'a5e34c1 my.package.name/my.package.name.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
    
    opened by FabianTerhorst 29
  • java.lang.VerifyError: Verifier rejected class ProductCursor: long  failed to verify: long. [0x50A] register v256 has type Undefined but expected Integer

    java.lang.VerifyError: Verifier rejected class ProductCursor: long failed to verify: long. [0x50A] register v256 has type Undefined but expected Integer

    Please help us to fix issues asap:

    Issue Basics

    • ObjectBox version : 1.5.0
    • Reproducibility: always

    Reproducing the bug

    Description

    This issue started occurring only after upgrading to Android Studio v3.1.3 from v3.1.2.

    Code

    Occurs whenever i try to access the Box for my Product prodBox.all.size == 0

    Logs & stackstraces

    Stacktrace:

        Process: com.gfxbandits.invizio, PID: 4412
        java.lang.VerifyError: Verifier rejected class com.gfxbandits.invizio.model.ProductCursor: long com.gfxbandits.invizio.model.ProductCursor.put(com.gfxbandits.invizio.model.Product) failed to verify: long com.gfxbandits.invizio.model.ProductCursor.put(com.gfxbandits.invizio.model.Product): [0x50A] register v256 has type Undefined but expected Integer (declaration of 'com.gfxbandits.invizio.model.ProductCursor' appears in /data/app/com.gfxbandits.invizio-1/split_lib_slice_0_apk.apk)
            at com.gfxbandits.invizio.model.ProductCursor$Factory.createCursor(ProductCursor.java:21)
            at io.objectbox.Transaction.createCursor(Transaction.java:166)
            at io.objectbox.Box.getReader(Box.java:81)
            at io.objectbox.Box.getAll(Box.java:320)
            at com.gfxbandits.invizio.fragment.CatalogueFragment$loadCatalogueOnline$1$1.onComplete(CatalogueFragment.kt:203)
            at com.google.android.gms.tasks.zzj.run(Unknown Source)
            at android.os.Handler.handleCallback(Handler.java:836)
            at android.os.Handler.dispatchMessage(Handler.java:103)
            at android.os.Looper.loop(Looper.java:203)
            at android.app.ActivityThread.main(ActivityThread.java:6251)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
    

    Entities

    Product.kt:

    import android.os.Parcelable
    import io.objectbox.annotation.Entity
    import io.objectbox.annotation.Id
    import io.objectbox.annotation.Index
    import kotlinx.android.parcel.Parcelize
    
    @Parcelize
    @Entity
    data class Product(@Id var id: Long = 0,
                       var isSynced: Boolean = false,
                       @Index var RFID: String = "",
                       @Index var SKU: String = "",
                       @Index var designNo: String = "",
                       @Index var imageName: String = "",
                       @Index var status: String = STATUS_IN_STOCK,
                       var salesManName: String = "",
                       @Index var type: String = "",
                       @Index var size: String = "",
                       @Index var grossWeight: String = "",
                       @Index var netWeight: String = "",
                       @Index var collectionLine: String = "",
                       @Index var category: String = "",
                       @Index var metalType: String = "",
                       @Index var metalPurity: String = "",
                       var metalWeight: String = "",
                       var totalDiamondWeight: String = "",
                       var totalStoneWeight: String = "",
                       var centerStoneType: String = "",
                       var centerStoneShape: String = "",
                       var centerStoneSize: String = "",
                       var centerStoneQuality: String = "",
                       var centerStoneColor: String = "",
                       var centerStoneWeight: String = "",
                       var centerStoneCertificate: String = "",
                       var centerStoneCut: String = "",
                       var stoneType: String = "",
                       var stoneShape: String = "",
                       var stoneSize: String = "",
                       var stoneQuality: String = "",
                       var stoneColor: String = "",
                       var stoneCount: String = "",
                       var stoneWeight: String = "",
                       var stoneCertificate: String = "",
                       var stoneCut: String = "",
                       var totalStoneCount: String = "",
                       var findingType: String = "",
                       var findingMetal: String = "",
                       var findingWeight: String = "",
                       var findingMetalPurity: String = "",
                       var goldLock: String = "",
                       var silverLock: String = "",
                       var platinumLock: String = "",
                       var costPrice: String = "",
                       var fobPrice: String = "",
                       var sellingPrice: String = "",
                       var metalPrice: String = "",
                       var diamondPrice: String = "",
                       var stonePrice: String = "",
                       var laborPrice: String = "",
                       var laborChargePerGram: String = "",
                       var setID: String = "",
                       var setImageName: String = "",
                       var company: String = "",
                       var location: String = "",
                       var counterNumber: String = "",
                       var counterDescription: String = "",
                       var trayNumber: String = "",
                       var trayDescription: String = "",
                       var owner: String = "",
                       var customer: String = "",
                       var reserved1: String = "",
                       var reserved2: String = "",
                       var reserved3: String = "",
                       var reserved4: String = "",
                       var reserved5: String = "",
                       var reserved6: String = "",
                       var reserved7: String = "",
                       var reserved8: String = "",
                       var reserved9: String = "",
                       var reserved10: String = "",
                       @Index var isSelected: Boolean = true,
                       @Index var isNewlyImported: Boolean = false
    ) : Parcelable {
      companion object {
        val STATUS_IN_STOCK = "INSTOCK"
        val STATUS_SALES_OUT = "SALESOUT"
        val STATUS_SOLD = "SOLD"
      }
    }
    

    Misc

    I also tried from Android Studio 3.2 Canary 17 but it still doesn't work. The app works normally if i downgrade to the last APK Built from Android Studio 3.1.2 (code is still same). I even tried disabling R8 by adding the following line to gradle.properties android.enableR8 = false

    I am using the following dependencies/libraries: -Apache POI for Android 3.12

    ext {
            kotlin_version = '1.2.41'
            support_lib_version = '27.1.1'
            google_services_version = '15.0.0'
            firebase_version = '15.0.0'
            objectboxVersion = '1.5.0'
            as_version='3.2.0-alpha17'
        }
    
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
    implementation "com.android.support:appcompat-v7:$support_lib_version"
    implementation "com.android.support:recyclerview-v7:$support_lib_version"
    implementation 'com.android.support.constraint:constraint-layout:1.1.1'
    implementation "com.android.support:support-v4:$support_lib_version"
    implementation "com.android.support:design:$support_lib_version"
    implementation "com.android.support:support-vector-drawable:$support_lib_version"
    implementation 'com.android.support:support-v4:27.1.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.github.florent37:runtime-permission-kotlin:1.0.1'
    implementation 'br.com.simplepass:loading-button-android:1.14.0'
    implementation 'com.amitshekhar.android:android-networking:1.0.1'
    implementation "com.google.firebase:firebase-core:$firebase_version"
    implementation "com.google.firebase:firebase-firestore:$firebase_version"
    implementation "com.google.firebase:firebase-storage:$firebase_version"
    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.3'
    implementation "io.objectbox:objectbox-android:$objectboxVersion"
    implementation "io.objectbox:objectbox-kotlin:$objectboxVersion"
    kapt "io.objectbox:objectbox-processor:$objectboxVersion"
    implementation 'com.jakewharton:butterknife:8.8.1'
    kapt 'com.jakewharton:butterknife-compiler:8.8.1'
    implementation 'id.zelory:compressor:2.1.0'
    implementation 'com.github.ghost1372:Mzip-Android:0.4.0'
    implementation 'com.shuhart.stepview:stepview:1.2.7'
    implementation 'com.appyvet:materialrangebar:1.4.1'
    implementation 'com.github.bumptech.glide:glide:4.7.1'
    kapt 'com.github.bumptech.glide:compiler:4.7.1'
    implementation 'com.firebaseui:firebase-ui-storage:3.3.1'
    implementation 'com.github.chrisbanes:PhotoView:2.1.3'
    implementation 'com.h6ah4i.android.widget.verticalseekbar:verticalseekbar:0.7.2'
    implementation 'com.github.ohoussein.playpauseview:playpauseview:1.0.2'
    implementation 'com.github.Ilhasoft:data-binding-validator:1.0.0'
    kapt "androidx.databinding:databinding-compiler:$as_version"
    implementation 'com.cloudrail:cloudrail-si-android:2.22.1'
    implementation 'com.google.code.gson:gson:2.8.4'
    implementation 'com.lowagie:itext:4.2.1'
    implementation 'com.github.medyo:fancybuttons:1.8.4'
    
    opened by shripal17 28
  • Object Browser App

    Object Browser App

    Allow to open ObjectBox databases with a generic browser.

    Main question: should this be something you can integrate into an app? Or do you prefer an desktop app? Or a web app?

    Pro app:

    • no need to pull database files to the desktop

    Pro desktop:

    • More screen estate
    • Also works for non-Android databases, e.g. desktop apps and unit tests

    Pro web app (e.g. write server in Kotlin with embedded netty):

    • More screen estate
    • Can be accessed locally on the device or on the desktop
    • Also works for non-Android databases, e.g. desktop apps and unit tests
    • Remotely accessible, e.g. you could use ObjectBox on a server and connect to it

    Pro Stetho

    • Existing infrastructure

    What would you prefer and why?

    enhancement 
    opened by greenrobot 27
  • FlatBuffers version conflicts with other library

    FlatBuffers version conflicts with other library

    Edit: this is due to FlatBuffers versions conflicting. See the comment below for details and potential workarounds. https://github.com/objectbox/objectbox-java/issues/894#issuecomment-674734559


    @greenrobot-team I have the same issue of duplicated dependencies (between ObjectBox and GoogleArCore Sceneform):

    Duplicate class com.google.flatbuffers.Constants found in modules jetified-flatbuffers-java-1.12.0.jar (com.google.flatbuffers:flatbuffers-java:1.12.0) and jetified-sceneform-base-1.15.0-runtime.jar (com.google.ar.sceneform:sceneform-base:1.15.0)
    Duplicate class com.google.flatbuffers.FlatBufferBuilder found in modules jetified-flatbuffers-java-1.12.0.jar (com.google.flatbuffers:flatbuffers-java:1.12.0) and jetified-sceneform-base-1.15.0-runtime.jar (com.google.ar.sceneform:sceneform-base:1.15.0)
    Duplicate class com.google.flatbuffers.FlatBufferBuilder$ByteBufferFactory found in modules jetified-flatbuffers-java-1.12.0.jar (com.google.flatbuffers:flatbuffers-java:1.12.0) and jetified-sceneform-base-1.15.0-runtime.jar (com.google.ar.sceneform:sceneform-base:1.15.0)
    Duplicate class com.google.flatbuffers.FlatBufferBuilder$HeapByteBufferFactory found in modules jetified-flatbuffers-java-1.12.0.jar (com.google.flatbuffers:flatbuffers-java:1.12.0) and jetified-sceneform-base-1.15.0-runtime.jar (com.google.ar.sceneform:sceneform-base:1.15.0)
    Duplicate class com.google.flatbuffers.Struct found in modules jetified-flatbuffers-java-1.12.0.jar (com.google.flatbuffers:flatbuffers-java:1.12.0) and jetified-sceneform-base-1.15.0-runtime.jar (com.google.ar.sceneform:sceneform-base:1.15.0)
    Duplicate class com.google.flatbuffers.Table found in modules jetified-flatbuffers-java-1.12.0.jar (com.google.flatbuffers:flatbuffers-java:1.12.0) and jetified-sceneform-base-1.15.0-runtime.jar (com.google.ar.sceneform:sceneform-base:1.15.0)
    Duplicate class com.google.flatbuffers.Utf8 found in modules jetified-flatbuffers-java-1.12.0.jar (com.google.flatbuffers:flatbuffers-java:1.12.0) and jetified-sceneform-base-1.15.0-runtime.jar (com.google.ar.sceneform:sceneform-base:1.15.0)
    Duplicate class com.google.flatbuffers.Utf8Safe found in modules jetified-flatbuffers-java-1.12.0.jar (com.google.flatbuffers:flatbuffers-java:1.12.0) and jetified-sceneform-base-1.15.0-runtime.jar (com.google.ar.sceneform:sceneform-base:1.15.0)
    

    If I follow the solution of @dpproduction everything works right. I mean adding:

     implementation ("io.objectbox:objectbox-android:$objectboxVersion"){
            exclude group: 'com.google.flatbuffers', module: 'flatbuffers-java'
        }
        annotationProcessor "io.objectbox:objectbox-processor:$objectboxVersion"
    
    and removing the "apply plugin: 'io.objectbox'".
    

    However I'm afraid of what you said of avoid removing the apply plugin.

    I tried to add apply plugin: 'io.objectbox' in every ways (after dependencies block, at the beggining of the build.gradle app file, after the apply plugin: 'com.android.application') but nothing worked. Just removing the apply plugin.

    Is there any solutions? What does it happen if I haven't the apply plugin? The ObjectBox library will work with errors?

    Thanks!!

    Originally posted by @nicodubi in https://github.com/objectbox/objectbox-java/issues/479#issuecomment-669634048

    bug 
    opened by nicodubi 25
  • Unique properties

    Unique properties

    It would be great to have unique annotation so that a put operation can detect, that this row is already existing and needs to be updated instead of creating a new one.

    I know this is possible already by making it the @id column and assignable, but sometimes one needs multiple unique columns.

    Also this would allow to have different types of keys as one could possibly also use a string.

    enhancement 
    opened by kordianbruck 25
  • Add loongarch64 support

    Add loongarch64 support

    The LoongArch architecture (LoongArch) is an Instruction Set Architecture (ISA) that has a RISC style.

    Documentations: ISA: https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html ABI: https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html More docs can be found at: https://loongson.github.io/LoongArch-Documentation/README-EN.html

    opened by zhaixiaojuan 0
  • ObjectBox is not entirely FOSS

    ObjectBox is not entirely FOSS

    Hello ObjectBox team!

    In the instructions on the README of the project, we have these instructions:

    buildscript {
        ext.objectboxVersion = "3.3.1"
        repositories {        
            mavenCentral()    
        }
        dependencies {
            classpath("io.objectbox:objectbox-gradle-plugin:$objectboxVersion")
        }
    }
    

    The plugin added to the classpath is in MavenCentral, this is the latest published version.

    As an educated developer, I downloaded the sources jar, so that I could validate the source code that my app is using.

    Inside that file, however, there's only a README file:

    Not available yet

    And naturally, by downloading the Jar file, only .class files are available.


    For this reason, the gradle plugin is considered proprietary code. And this has lead F-Droid - the main FLOSS Android distributor - has blocked many apps, such as

    • https://github.com/LeoColman/Petals/issues/98
    • https://github.com/owntracks/android/issues/1298
    • https://github.com/Nonononoki/Hendroid/issues/70
    • https://github.com/kiwix/kiwix-android/issues/3091

    And probably more to come.


    This is a very serious bug. I imagine it's somewhere where the code is published to MavenCentral that is not including the source codes.

    This issue is a blocker for anyone that wants to integrate ObjectBox to an 100% FLOSS app, such as ones deployed to F-Droid

    opened by LeoColman 3
  • LinkageError when two programs use ObjectBox and share the same .dll.

    LinkageError when two programs use ObjectBox and share the same .dll.

    Describe the bug A Java program will not work if another Java program uses ObjectBox.

    Basic info:

    • ObjectBox version: 3.2.1
    • Reproducibility: always
    • Device: Desktop Java
    • OS: Windows 10, Windows 11 & Linux

    To Reproduce See the Is there anything special about your app?.

    Probable way to reproduce the behaviour without using Spigot plugins:

    1. Create two projects that use ObjectBox and place them in the same folder.
    2. Execute each application
    3. See error

    Way to reproduce the behaviour USING Spigot plugins:

    1. Create two Spigot plugins that use ObjectBox.
    2. Place the plugins under the \plugins folder.
    3. Start the server & see the error for one plugin.

    Expected behavior ObjectBox should be able to use different .dll files in order for this error not to happen. This could be worked around by providing a method to specify the location of the .dll file, https://github.com/objectbox/objectbox-java/issues/973

    Logs, stack traces

    [15:34:38 WARN]: Caused by: java.lang.LinkageError: [ObjectBox] Loading native library failed, please report this to us: vendor=Oracle Corporation,os=linux,os.arch=amd64,model=64,linux=true,machine=x86_64
    
    [21:23:30 WARN]: java.io.FileNotFoundException: objectbox-jni-windows-x64.dll (El proceso no tiene acceso al archivo porque está siendo utilizado por otro proceso)
    [21:23:30 WARN]:        at java.base/java.io.FileOutputStream.open0(Native Method)
    [21:23:30 WARN]:        at java.base/java.io.FileOutputStream.open(FileOutputStream.java:293)
    [21:23:30 WARN]:        at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:235)
    [21:23:30 WARN]:        at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:184)
    [21:23:30 WARN]:        at Plugin-1.0-SNAPSHOT.jar//io.objectbox.internal.NativeLibraryLoader.checkUnpackLib(NativeLibraryLoader.java:227)
    [21:23:30 WARN]:        at Plugin-1.0-SNAPSHOT.jar//io.objectbox.internal.NativeLibraryLoader.<clinit>(NativeLibraryLoader.java:75)
    [21:23:30 WARN]:        at Plugin-1.0-SNAPSHOT.jar//io.objectbox.BoxStore.<init>(BoxStore.java:262)
    [21:23:30 WARN]:        at Plugin-1.0-SNAPSHOT.jar//io.objectbox.BoxStoreBuilder.build(BoxStoreBuilder.java:516)
    [21:23:30 WARN]:        at Plugin-1.0-SNAPSHOT.jar//dev.ckblck.referrals.logic.reward.storage.pending.PendingRewardDatabase.loadDatabase(PendingRewardDatabase.java:79)
    [21:23:30 WARN]:        at Plugin-1.0-SNAPSHOT.jar//dev.ckblck.referrals.logic.reward.storage.pending.PendingRewardDatabase.<init>(PendingRewardDatabase.java:30)
    [21:23:30 WARN]:        at Plugin-1.0-SNAPSHOT.jar//dev.ckblck.referrals.Plugin.lambda$onEnable$0(Plugin.java:82)
    [21:23:30 WARN]:        at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804)
    [21:23:30 WARN]:        at java.base/java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796)
    [21:23:30 WARN]:        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
    [21:23:30 WARN]:        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
    [21:23:30 WARN]:        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
    [21:23:30 WARN]:        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
    [21:23:30 WARN]:        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
    [21:23:30 WARN]: java.util.concurrent.CompletionException: java.lang.LinkageError: [ObjectBox] Loading native library failed, please report this to us: vendor=Amazon.com Inc.,os=windows 10,os.arch=amd64,model=64,linux=false,machine=null
    [21:23:30 WARN]:        at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315)
    [21:23:30 WARN]:        at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320)
    [21:23:30 WARN]:        at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1807)
    [21:23:30 WARN]:        at java.base/java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796)
    [21:23:30 WARN]:        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
    [21:23:30 WARN]:        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
    [21:23:30 WARN]:        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
    [21:23:30 WARN]:        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
    [21:23:30 WARN]:        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
    [21:23:30 WARN]: Caused by: java.lang.LinkageError: [ObjectBox] Loading native library failed, please report this to us: vendor=Amazon.com Inc.,os=windows 10,os.arch=amd64,model=64,linux=false,machine=null
    

    Additional context

    • Is there anything special about your app? I'm using ObjectBox for Spigot Java plugins. In this context, the objectbox-jni-windows-x64 is being shared for all the plugins that use ObjectBox, and as far as I'm aware, there is no viable way to modify the location of the objectbox-jni-windows-x64 file for each instance. Possibly related with https://github.com/objectbox/objectbox-java/issues/973 The Spigot standalone loads each plugin and when two plugins are using ObjectBox, the error occurrs.
    enhancement 
    opened by Ckblck 2
  • Download All in Objectbox Admin fails

    Download All in Objectbox Admin fails

    Hello,

    from version 3.1.0 and above it is not possible to download the tables in ObjectBox Admin anymore. It just responses 401 - Session ID not present.

    When I downgrade Objectbox to 3.0.1, download is possible.

    Steps to Reproduce:

    • Create Android App project
    • In app.java:
    @Override
       public void onCreate() {
     [...]
          if (BuildConfig.DEBUG_MODE) {
    /*          Admin objectBoxAdmin = new Admin(getObjectBoxIO().getBoxStore(this.getBaseContext()));
              objectBoxAdmin.start(this);
              objectBoxAdmin.setNotificationId(1);*/
              AndroidObjectBrowser objectBrowser = new AndroidObjectBrowser(getObjectBoxIO().getBoxStore(this.getBaseContext()));
              objectBrowser.setNotificationId(1);
              objectBrowser.start(this.getBaseContext());
    
              /*Admin archieveBoxAdmin = new Admin(getArchiveBoxIO().getBoxStore(this.getBaseContext()));
              archieveBoxAdmin.setNotificationId(2);
              archieveBoxAdmin.start(this);*/
              AndroidObjectBrowser archiveBrowser = new AndroidObjectBrowser(getArchiveBoxIO().getBoxStore(this.getBaseContext()));
              archiveBrowser.setNotificationId(2);
              archiveBrowser.start(this.getBaseContext());
          }
     [...]
    }
    
    • start application on emulator
    • In Terminal:
    adb forward tcp:8090 tcp:8090
    adb forward tcp:8091 tcp:8091
    
    • Open Objectbox Admin in browser on dev machine and click on download all.

    I tried both the deprecated syntax via AndroidObjectBrowser and the new one calling new Admin(...). The result is the same in both ways.

    Note, that my app addresses two databases in which I store in different locations by setting the file path via

    MyObjectBox.builder()
                    .name("dbxyz")
                    .androidContext(context.getApplicationContext())
                    .build();
    

    in the wrapper classes ObjectBoxIO and ArchiveBoxIO.

    Best regards Thomas

    bug 
    opened by Schmalztopf 1
  • Use ForkJoinPool and provide builder API to limit threads count.

    Use ForkJoinPool and provide builder API to limit threads count.

    This PR provide API to configure thread pool limits use by BoxStore.

    I was observed situation in Android application where (due to some other issues in app) application is crashed with OOM. At the moment of crash there were tens of alive threads belong to ObjectBox pool. The numbering suggest that thousands of thread were already created and destroyed by the pool at the moment of crash. So it would be nice to have an API to limit number of threads allowed in thread pool and minimum number of threads as well. This of course will not solve original problem with app I was debugging, but will probably help to reveal root problem earlier.

    opened by mstyura 3
Releases(V3.5.0)
  • V3.5.0(Dec 7, 2022)

    • This release includes breaking changes to generated code. If you encounter build errors, make sure to clean and build your project (e.g. Build > Rebuild project in Android Studio).
    • Add Query.copy() and QueryThreadLocal to obtain a Query instance to use in different threads. Learn more about re-using queries. #1071
    • Add relationCount query condition to match objects that have a certain number of related objects pointing to them. E.g. Customer_.orders.relationCount(2) will match all customers with two orders, Customer_.orders.relationCount(0) will match all customers with no associated order. This can be useful to find objects where the relation was dissolved, e.g. after the related object was removed.
    • Allow using a relation target ID property with a property query. E.g. query.property(Order_.customerId) will map results to the ID of the customer of an order. #1028
    • Add docs on DbFullException about why it occurs and how to handle it.
    • Do not fail to transform an entity class that contains a transient relation field when using Android Gradle Plugin 7.1 or lower.
    • Restore compatibility for Android projects using Gradle 6.1. The minimum supported version for Gradle is 6.1 and for the Android Gradle Plugin 3.4. This should make it easier for older projects to update to the latest version of ObjectBox.
    • Data Sync (only): protocol updates improving efficiency. Reach out via your existing contact to check if any actions are required for your setup.
    Source code(tar.gz)
    Source code(zip)
  • V3.4.0(Oct 18, 2022)

    • Add findFirstId() and findUniqueId() to Query which just return the ID of a matching object instead of the full object.
    • Experimental support for setting a maximum data size via the maxDataSizeInKByte property when building a Store. This is different from the existing maxSizeInKByte property in that it is possible to remove data after reaching the limit and continue to use the database. See its documentation for more details.
    • Fix a crash when querying a value-based index (e.g. @Index(type = IndexType.VALUE)) on Android 32-bit ARM devices. #1105
    • Various small improvements to the native libraries.

    Note: Looking for Sync? There is no Sync version for this release, please continue using 3.2.1.

    Source code(tar.gz)
    Source code(zip)
  • V3.3.1(Sep 6, 2022)

    Note: V3.3.0 contains a bug preventing correct transformation of some classes, please use V3.3.1 instead.

    Note: there is no Sync version for this release, please continue using 3.2.1.

    • Gradle plugin: use new transform API with Android Plugin 7.2.0 and newer. Builds should be slightly faster as only entity and cursor classes and only incremental changes are transformed. #1078
    • Gradle plugin: improve detection of applied Android plugins, improve registration of byte-code transform for non-Android Java projects, add check for minimum supported version of Gradle.
    • Various small improvements to the native libraries.
    Source code(tar.gz)
    Source code(zip)
  • V3.2.1(Jul 5, 2022)

    • Resolve an issue that prevented resources from getting cleaned up after closing BoxStore, causing the reference table to overflow when running many instrumentation tests on Android. #1080
    • Plugin: support Kotlin 1.7. #1085
    Source code(tar.gz)
    Source code(zip)
  • V3.2.0(Jun 21, 2022)

    • Query: throw IllegalStateException when query is closed instead of crashing the virtual machine. #1081
    • BoxStore and Query now throw IllegalStateException when trying to subscribe but the store or query is closed already.
    • Various internal improvements including minor optimizations for binary size and performance.
    Source code(tar.gz)
    Source code(zip)
  • V3.1.3(May 11, 2022)

    • Windows: using a database directory path that contains unicode (UTF-8) characters does not longer create an additional, unused, directory with garbled characters.
    • Query: when using a negative offset or limit display a helpful error message.
    • Processor: do not crash, but error if ToOne/ToMany type arguments are not supplied (e.g. ToOne instead of ToOne<Entity>).
    • The Data Browser has been renamed to ObjectBox Admin. Deprecated AndroidObjectBrowser, use Admin instead. AndroidObjectBrowser will be removed in a future release.
    Source code(tar.gz)
    Source code(zip)
  • V3.1.2(Feb 22, 2022)

  • V3.1.1(Jan 26, 2022)

    This release only contains bug fixes.

    • Fix incorrect unique constraint violation if an entity contains at least two unique properties with a certain combination of non-unique indexes.
    • Data Browser/Admin: improved support when running multiple on the same host, but a different port (e.g. localhost:8090 and localhost:8091).
    Source code(tar.gz)
    Source code(zip)
  • V3.1.0(Jan 10, 2022)

    Read the blog post with more details and code examples for the new flex properties and query conditions.

    • Support Flex properties. Expanding on the string and flexible map support in 3.0.0, it is now possible to add a property using Object in Java or Any? in Kotlin. These "flex properties" now allow to store values of various types like integers, floating point values, strings and byte arrays. Or lists and maps (using string keys) of those. Some limitations apply, see the FlexObjectConverter class documentation for details.
      @Entity
      data class Customer(
          @Id var id: Long = 0,
          var tag: Any? = null
      )
      
      val customerStrTag = Customer(tag = "string-tag")
      val customerIntTag = Customer(tag = 1234)
      box.put(customerStrTag, customerIntTag)
      
    • The containsElement query condition now matches keys of string map properties. It also matches string or integer elements of a Flex list.
    • New containsKeyValue query condition to match key/value combinations of string map and Flex map properties containing strings and integers. Also added matching Query.setParameters overload.
      val customer = Customer(
          properties = mutableMapOf("premium" to "tier-1")
      )
      box.put(customer)
      
      // Query for any customers that have a premium key in their properties map
      val queryPremiumAll = box.query(
          Customer_.properties.containsElement("premium")
      ).build()
      
      // Match only customers with specific key and value map entry
      val queryPremiumTier1 = box.query(
          Customer_.properties.containsKeyValue("premium", "tier-1")
      ).build()
      
    • Add ProGuard/R8 rule to not warn about SuppressFBWarnings annotation. #1011
    • Add more detailed error message when loading the native library fails on Android. #1024
    • Data browser: byte arrays are now correctly displayed in Base64 encoding. #1033

    Kotlin

    • Add BoxStore.awaitCallInTx suspend function which wraps BoxStore.callInTx.

    Gradle plugin

    • Do not crash trying to add dependencies to Java desktop projects that only apply the Gradle application plugin.

    Read more in the docs

    Source code(tar.gz)
    Source code(zip)
  • V3.0.1(Oct 19, 2021)

  • V3.0.0(Oct 19, 2021)

    Note: this version contains a bug that prevents usage with Android Java only projects. Use 3.0.1 instead.

    • A new Query API is available that works similar to the ObjectBox for Dart/Flutter Query API and makes it easier to create nested conditions. #201
      // equal AND (less OR oneOf)
      val query = box.query(
            User_.firstName equal "Joe"
                    and (User_.age less 12
                    or (User_.stamp oneOf longArrayOf(1012))))
            .order(User_.age)
            .build()
      
    • For the existing Query API, String property conditions now require to explicitly specify case. See the documentation of StringOrder for which one to choose (typically StringOrder.CASE_INSENSITIVE).
      // Replace String conditions like
      query().equal(User_.firstName, "Joe")
      // With the one accepting a StringOrder
      query().equal(User_.firstName, "Joe", StringOrder.CASE_INSENSITIVE)
      
    • The Gradle plugin will now warn when an @Entity class is missing a no-arg (easy to add) or all properties (best for performance) constructor. #900 Example for an all properties constructor:
      @Entity
      public class Order {
      
          @Id
          private long id;
          private ToOne<Customer> customer;
          private ToMany<Order> relatedOrders;
      
          // All properties constructor for ObjectBox:
          // - make sure type matches exactly,
          // - for ToOne add its virtual ID property instead,
          // - for ToMany add no parameter.
          public Order(long id, long customerId) {
              this.id = id;
              this.customer.setTargetId(customerId);
          }
      
          // TODO getters and setters for properties
      }
      
    • Subscriptions now publish results in serial instead of in parallel (using a single thread vs. multiple threads per publisher). Publishing in parallel could previously lead to outdated results getting delivered after the latest results. As a side-effect transformers now run in serial instead of in parallel as well (on the same single thread per publisher). #793
    • Support annotating a single property with @Unique(onConflict = ConflictStrategy.REPLACE) to replace an existing Object if a conflict occurs when doing a put. #509
      @Entity
      data class Example(
              @Id
              var id: Long = 0,
              @Unique(onConflict = ConflictStrategy.REPLACE)
              var uniqueKey: String? = null
      )
      
    • Support @Unsigned to indicate that values of an integer property (e.g. Integer and Long in Java) should be treated as unsigned when doing queries or creating indexes.
    • Store time in nanoseconds using the new @Type annotation:
      @Type(DatabaseType.DateNano)
      var timeInNanos: Long;
      
    • Package FlatBuffers version into library to avoid conflicts with apps or other libraries using FlatBuffers. #894
    • Kotlin: add Flow extension functions for BoxStore and Query. #990
    • Data browser: display query results if a property has a NaN value. #984
    • Android 12: support using Data Browser if targeting Android 12 (SDK 31). #1007

    New supported property types

    • String arrays (Java String[] and Kotlin Array<String>) and lists (Java List<String> and Kotlin MutableList<String>). Using the new containsElement("item") condition, it is also possible to query for entities where "item" is equal to one of the elements.
      @Entity
      data class Example(
              @Id
              var id: Long = 0,
              var stringArray: Array<String>? = null,
              var stringMap: MutableMap<String, String>? = null
      )
      
      // matches [“first”, “second”, “third”]
      box.query(Example_.stringArray.containsElement(“second”)).build()
      
    • String maps (Java Map<String, String> or Kotlin MutableMap<String, String>). Stored internally as a byte array using FlexBuffers.
    • Flexible maps:
      • map keys must all have the same type,
      • map keys or values must not be null,
      • map values must be one of the supported database type, or a list of them (e.g. String, Boolean, Integer, Double, byte array...).

    Sync

    • The generated JSON model file no longer contains Java-specific flags that would lead to errors if used with Sync server.
    • Additional checks when calling client or server methods.

    All release notes & docs

    Source code(tar.gz)
    Source code(zip)
  • V2.9.1(Mar 16, 2021)

    This is the first release available on the Central repository (Sonatype OSSRH). Make sure to adjust your build.gradle files accordingly:

    repositories {
        mavenCentral()
    }
    

    Changes:

    • Javadoc for find(offset, limit) of Query is more concrete on how offset and limit work.
    • Javadoc for between conditions explicitly mentions it is inclusive of the two given values.
    • Sync: Instead of the same name and a Maven classifier, Sync artifacts now use a different name. E.g. objectbox-android:2.9.0:sync is replaced with objectbox-sync-android:2.9.1.

    All release notes & docs

    Source code(tar.gz)
    Source code(zip)
  • V2.9.0(Feb 22, 2021)

    • Query: Add lessOrEqual and greaterOrEqual conditions for long, String, double and byte[] properties.
    • Support Java applications on ARMv7 and AArch64 devices. #657 To use, add implementation "io.objectbox:objectbox-linux-armv7:$objectboxVersion or implementation "io.objectbox:objectbox-linux-arm64:$objectboxVersion to your dependencies. Otherwise the setup is identical with Java Desktop Apps.
    • Resolve rare ClassNotFoundException: kotlin.text.Charsets when running processor. #946
    • Ensure Query setParameters works if running the x86 library on x64 devices (which could happen if ABI filters were set up incorrectly). #927

    Previous release notes & docs

    Source code(tar.gz)
    Source code(zip)
  • V2.8.1(Nov 23, 2020)

  • V2.8.0(Nov 23, 2020)

    • Added Sync API.
    • Fixed "illegal reflective access" warning in the plugin.
    • The data browser notification is now silent by default, for quieter testing. #903
    • Updated and improved API documentation in various places (e.g. on how Query.findLazy() and Query.findLazyCached() work with LazyList #906).
    • Print full name and link to element for @Index and @Id errors. #902
    • Explicitly allow to remove a DbExceptionListener by accepting null values for BoxStore.setDbExceptionListener(listener).

    Previous release notes

    Source code(tar.gz)
    Source code(zip)
  • V2.7.1(Aug 24, 2020)

    • Fix exception handling during BoxStoreBuilder.build() to allow retries. For example, after a FileCorruptException you could try to open the database again using the recently added usePreviousCommit() option.
    • Add PagesCorruptException as a special case of FileCorruptException.
    • DbExceptionListener is called more robustly.

    Previous release notes

    Source code(tar.gz)
    Source code(zip)
  • V2.7.0(Aug 3, 2020)

    • Several database store improvements for BoxStore and BoxStoreBuilder
      • New configuration options to open the database, e.g. a new read-only mode and using the previous data snapshot (second last commit) to potentially recover data.
      • Database validation. We got a GitHub report indicating that some specific devices ship with a broken file system. While this is not a general concern (file systems should not be broken), we decided to detect some typical problems and provide some options to deal with these.
      • Get the size on disk
    • Add an efficient check if an object exist in a Box via contains(id).
    • Android improvements
      • Resolve Android Studio Build Analyzer warning about a prepare tasks not specifying outputs.
      • Data Browser drawables are no longer packaged in the regular Android library. #857
    • Fixes for one-to-many relations, e.g. allow removing both entity classes of a one-to-many relation. #859

    See also https://docs.objectbox.io/

    Source code(tar.gz)
    Source code(zip)
  • V2.6.0(Jun 30, 2020)

    • @DefaultValue("") annotation. Annotated properties will return the specified default value (currently only "" is supported) instead of null. This is useful if a not-null property is added to an entity, but there are existing entities in the database that will return null for the new property. Note: naming is not final, it may change to e.g. @AbsentValue(""). #157
    • RxJava 3 support library objectbox-rxjava3. Also includes Kotlin extension functions to more easily obtain Rx types, e.g. use query.observable() to get an Observable. #83
    • The annotation processor is incremental by default. #620
    • Fix error handling if ObjectBox can't create a Java entity (the proper exception is now thrown).
    • Support setting an alias after combining conditions using and() or or(). #83
    • Add documentation that string property conditions ignore case by default. Point to using case-sensitive conditions for high-performance look-ups, e.g. when using string UIDs.
    • Repository Artifacts are signed once again.

    Changes since 2.6.0-RC (released on 2020/04/28):

    • Performance improvements with query links (aka "joins"). Note: the order of results has changed unless you explicitly specified properties to order by. Remember: you should not depend on any internal order. If you did, this is a good time to fix it.
    • objectbox-java no longer exposes the greenrobot-essentials and FlatBuffers dependencies to consuming projects.
    • Minor code improvements.

    See the full changelog for more details.

    Source code(tar.gz)
    Source code(zip)
  • V2.6.0-RC(May 4, 2020)

  • V3.0.0-alpha2(Mar 24, 2020)

    Note: this is a preview release. Future releases may add, change or remove APIs.

    • Add Kotlin infix extension functions for creating conditions using the new Query API. See the documentation for examples.
    • The old Query API now also supports setting an alias after combining conditions using and() or or(). #834
    • Add documentation that string property conditions ignore case by default. Point to using case-sensitive conditions for high-performance look-ups, e.g. when using string UIDs.
    • Java's String[] and Kotlin's Array<String> are now a supported database type. A converter is no longer necessary to store these types. Using the arrayProperty.equal("item") condition, it is possible to query for entities where "item" is equal to one of the array items.
    • Support @Unsigned to indicate that values of an integer property (e.g. Integer and Long in Java) should be treated as unsigned when doing queries or creating indexes. See the Javadoc of the annotation for more details.
    • ~Support marking 64-bit integer properties (e.g. Long in Java) with @Type(DateNano) to indicate the database should treat these values as time with nanosecond precision. Note: to store time in millisecond precision continue to use java.util.Date (without annotation).~ This is not ready, yet.
    • Add new library to support RxJava 3, objectbox-rxjava3. In addition, objectbox-kotlin adds extension functions to more easily obtain Rx types, e.g. use query.observable() to get an Observable. #839

    To use this release change the version of objectbox-gradle-plugin to 3.0.0-alpha2. The plugin now properly adds the preview version of objectbox-java to your dependencies.

    buildscript {
        dependencies {
            classpath "io.objectbox:objectbox-gradle-plugin:3.0.0-alpha2"
        }
    }
    
    dependencies {
        // Artifacts with native code remain at 2.5.1.
        implementation "io.objectbox:objectbox-android:2.5.1"
    }
    

    The objectbox-android, objectbox-linux, objectbox-macos and objectbox-windows artifacts shipping native code remain at version 2.5.1 as there have been no changes. If you explicitly include them, make sure to specify their version as 2.5.1.

    Source code(tar.gz)
    Source code(zip)
  • V3.0.0-alpha1(Mar 9, 2020)

    Note: this is a preview release. Future releases may add, change or remove APIs.

    • A new Query API provides support for nested AND and OR conditions. See the documentation for examples and notable changes. #201
    • Subscriptions now publish results in serial instead of in parallel (using a single thread vs. multiple threads per publisher). Publishing in parallel could previously lead to outdated results getting delivered after the latest results. As a side-effect transformers now run in serial instead of in parallel as well (on the same single thread per publisher). #793
    • Turn on incremental annotation processing by default. #620

    To use this release change the version of objectbox-gradle-plugin to 3.0.0-alpha1 and add a dependency on objectbox-java version 3.0.0-alpha1.

    buildscript {
        dependencies {
            classpath "io.objectbox:objectbox-gradle-plugin:3.0.0-alpha1"
        }
    }
    
    dependencies {
        implementation "io.objectbox:objectbox-java:3.0.0-alpha1"
        // Artifacts with native code remain at 2.5.1.
        implementation "io.objectbox:objectbox-android:2.5.1"
    }
    

    The objectbox-android, objectbox-linux, objectbox-macos and objectbox-windows artifacts shipping native code remain at version 2.5.1 as there have been no changes. However, if your project explicitly depends on them they will pull in version 2.5.1 of objectbox-java. Make sure to add an explicit dependency on of objectbox-java version 3.0.0-alpha1 as mentioned above.

    Source code(tar.gz)
    Source code(zip)
  • V2.5.1(Feb 17, 2020)

    • Support Android Gradle Plugin 3.6.0. #817

    • Support for incremental annotation processing. #620 It is off by default. To turn it on set objectbox.incremental to true in build.gradle:

      android {
          defaultConfig {
              javaCompileOptions {
                  annotationProcessorOptions {
                      arguments = [ "objectbox.incremental" : "true" ]
                  }
              }
          }
      }
      

    https://docs.objectbox.io/#v-2-5-1-2020-02-10

    Source code(tar.gz)
    Source code(zip)
  • V2.5.0(Jun 30, 2020)

  • V2.4.1(Nov 4, 2019)

    • More helpful error messages if annotations can not be combined.
    • Improved documentation on various annotations.

    https://docs.objectbox.io/#v-2-4-1-2019-10-29

    Source code(tar.gz)
    Source code(zip)
  • V2.4.0(Oct 15, 2019)

    This release has mainly quality of life improvements and resolves reported issues.

    Android: after updating to this version your app might require changes before it can build successfully. See the upgrade notes for details: https://docs.objectbox.io/#v-2-4-0-2019-10-15

    Release notes: https://docs.objectbox.io/

    Source code(tar.gz)
    Source code(zip)
  • V2.4.0-RC(Oct 3, 2019)

  • V2.3.4(Mar 20, 2019)

  • V2.3.3(Feb 14, 2019)

  • V2.3.1(Jan 8, 2019)

  • V2.3.0(Dec 30, 2018)

Owner
ObjectBox
ObjectBox object oriented database - up to 10x faster than SQLite
ObjectBox
Realm is a mobile database: a replacement for SQLite & ORMs

Realm is a mobile database that runs directly inside phones, tablets or wearables. This repository holds the source code for the Java version of Realm

Realm 11.4k Jan 9, 2023
A key-value database for Android

SnappyDB SnappyDB is a key-value database for Android it's an alternative for SQLite if you want to use a NoSQL approach. It allows you to store and g

Nabil Hachicha 1.8k Dec 28, 2022
Insanely easy way to work with Android Database.

Sugar ORM Insanely easy way to work with Android databases. Official documentation can be found here - Check some examples below. The example applicat

null 2.6k Dec 16, 2022
A helper library to help using Room with existing pre-populated database [].

Room now supports using a pre-packaged database out of the box, since version 2.2.0 https://developer.android.com/jetpack/androidx/releases/room#2.2.0

Ibrahim Eid 136 Nov 29, 2022
A library for reading Shared Preferences and Database values within the application.

AppDataReader A library for reading and writing Shared Preferences and Database values of the application within the device. Advantages of using this

Anshul Jain 124 Nov 25, 2022
Android Database Performance Benchmarks

ℹ Check out our new performance test app that includes ObjectBox. Android Database Performance Benchmark This project evaluates Android databases and

Markus Junginger 80 Nov 25, 2022
A quick and easy database manager plugin library for your DBFlow databases.

DBFlowManager A quick and easy database manager and viewer plugin library for your DBFlow databases to view, insert, delete, update the tables directl

Wajahat Karim 26 Oct 21, 2022
Kodein-DB is a Kotlin/Multiplatform embedded NoSQL database that works on JVM, Android, Kotlin/Native and iOS.

Kodein-DB is a Kotlin/Multiplatform embedded NoSQL database that works on JVM, Android, Kotlin/Native and iOS. It is suited for client or mobile applications.

null 277 Dec 3, 2022
Test any type of cloud database on Android apps. No need of a dedicated backend.

Test any type of cloud database on Android apps. No need of a dedicated backend.

Arjun 9 May 9, 2022
Android with Real-time Database

Android with Real-time Database It was too much effort to build my own real-time database, but the result really satisfying, so it was worth it. Note

null 4 Jun 14, 2022
Wallum is a superfast ⚡ lightweight wallpaper app, built using Kotlin, Retrofit, MVVM, Paging 3, Hilt, and Navigation Components

Show some ❤️ and star the repo to show support for the project Wallum Android App Wallum is a super-fast ?? , lightweight wallpaper app built purely w

Aditya Verma 19 Dec 6, 2022
A blazing fast, powerful, and very simple ORM android database library that writes database code for you.

README DBFlow is fast, efficient, and feature-rich Kotlin database library built on SQLite for Android. DBFlow utilizes annotation processing to gener

Andrew Grosner 4.9k Dec 30, 2022
A blazing fast, powerful, and very simple ORM android database library that writes database code for you.

README DBFlow is fast, efficient, and feature-rich Kotlin database library built on SQLite for Android. DBFlow utilizes annotation processing to gener

Andrew Grosner 4.9k Dec 30, 2022
A Modern Kotlin-Ktor RESTful API example. Connects to a PostgreSQL database and uses Exposed framework for database operations.

kotlin-ktor-rest-api A Modern Kotlin-Ktor RESTful API example. Connects to a PostgreSQL database and uses Exposed framework for database operations. F

Selim Atasoy 32 Dec 20, 2022
Minimum-mvvm-room-database - MVVM With Simple Room Database

Minimum MVVM Koin (Kotlin Dependency Injection) Coroutines View Model Lifecycle

Faisal Amir 7 Oct 9, 2022
greenDAO is a light & fast ORM solution for Android that maps objects to SQLite databases.

Check out ObjectBox Check out our new mobile database ObjectBox (GitHub repo). ObjectBox is a superfast object-oriented database with strong relation

Markus Junginger 12.6k Jan 3, 2023
A Java serialization/deserialization library to convert Java Objects into JSON and back

Gson Gson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON string to a

Google 21.7k Jan 5, 2023
User onboarding library with smooth animation of objects and background colors

SlidingTutorial Cleveroad introduces Sliding Tutorial Library for Flutter Hey guys, hope you haven’t started developing a tutorial for your Flutter ap

Cleveroad 127 Dec 31, 2022
Android library to easily serialize and cache your objects to disk using key/value pairs.

Deprecated This project is no longer maintained. No new issues or pull requests will be accepted. You can still use the source or fork the project to

Anup Cowkur 667 Dec 22, 2022