Troubleshooting
Solutions for common issues with ObjectBox db for Java, Kotlin and Android

Unresolved reference: MyObjectBox (class not found, etc.)

MyObjectBox is a generated class, so make sure the project builds successfully. Resolve any other build errors.
Check that the project is configured correctly. E.g. for Kotlin, check that the kapt plugin is applied (apply plugin: 'kotlin-kapt') before the ObjectBox plugin.
android-apt is known to cause problems, try to remove it.

Merge conflict or DbException after concurrent data model modifications

If your team makes concurrent modifications to the data model (e.g. adding/removing entities or properties) it may clash with your changes. Read the meta model docs on how to resolve the conflicts.

DbException after switching git branch (no concurrent data model modifications)

You might get an exception like DbException DB’s last entity ID 4 is higher than 3 from model after switching back from a branch and running your app. This is expected if that branch makes incompatible changes to entities. You need to uninstall or clear all data of your app before running it again.
Here is why: Let’s say you have created a new entity on a new branch and ran your app on a device. This will upgrade the ObjectBox database on that device to support the new entity (ObjectBox keeps track of entity types internally by storing some meta info inside the database). Now, when you return to your previous branch and try to run the app ObjectBox will fail with an error message similar to the one above. This is because the entity types passed by your code no longer match those stored inside the database. In other words, the database can not be downgraded to the previous version. Thus, it is advised to clear the database before running your app after switching branches. Check the meta model docs for more details.

Couldn’t find “libobjectbox.so”

This can have various reasons. In general check your ABI filter setup or add one in your Gradle build file.
If your app explicitly ships code for "armeabi": For Android, ObjectBox comes with binaries for “armeabi-v7a” and “arm64-v8a” ABIs. We consider “armeabi” to be outdated and thus do not support it. Check if you have a Gradle config like abiFilters "armeabi", which is causing the problem (e.g. remove it or change it to “armeabi-v7a”).
If your app uses split APKs or App Bundle: some users might have sideloaded your APK that includes the library for a platform that is incompatible with the one of their device. See App Bundle, split APKs and Multidex for workarounds.

Version conflict with ‘com.google.code.findbugs:jsr305’

If you are doing Android instrumentation (especially with Espresso), you may get a warning like this: Error:Conflict with dependency ‘com.google.code.findbugs:jsr305’ in project ‘:app’. Resolved versions for app (3.0.2) and test app (2.0.1) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
You can easily resolve the version conflict by adding this Gradle dependency: androidTestCompile 'com.google.code.findbugs:jsr305:3.0.2'

Incompatible property type

Check the data model migration guide if you get an exception like: io.objectbox.exception.DbException: Property […] is not compatible to its previous definition. Check its type.
or
Cannot change the following flags for Property

Error Codes

Sometimes you might get an error code along with a error message. Typically, you will find error codes in parenthesis. Example:
Could not prepare directory: objectbox (30)
This error code comes from the OS, and gives you additional information; e.g. 30 tells that you tried to init a database in a read-only location of the file system, which cannot work.
Here's the list of typical OS errors:
Error code
Errno
Description
1
EPERM
Operation not permitted
2
ENOENT
No such file or directory
3
ESRCH
No such process
4
EINTR
Interrupted system call
5
EIO
I/O error
6
ENXIO
No such device or address
7
E2BIG
Argument list too long
8
ENOEXEC
Exec format error
9
EBADF
Bad file number
10
ECHILD
No child processes
11
EAGAIN
Try again
12
ENOMEM
Out of memory
13
EACCES
Permission denied
14
EFAULT
Bad address
15
ENOTBLK
Block device required
16
EBUSY
Device or resource busy
17
EEXIST
File exists
18
EXDEV
Cross-device link
19
ENODEV
No such device
20
ENOTDIR
Not a directory
21
EISDIR
Is a directory
22
EINVAL
Invalid argument
23
ENFILE
File table overflow
24
EMFILE
Too many open files
25
ENOTTY
Not a typewriter
26
ETXTBSY
Text file busy
27
EFBIG
File too large
28
ENOSPC
No space left on device
29
ESPIPE
Illegal seek
30
EROFS
Read-only file system
31
EMLINK
Too many links
32
EPIPE
Broken pipe
33
EDOM
Math argument out of domain of func
34
ERANGE
Math result not representable

Help with other issues

If you believe to have found a bug or missing feature, please create an issue. https://github.com/objectbox/objectbox-java/issues
If you have a usage question regarding ObjectBox, please post on Stack Overflow. https://stackoverflow.com/questions/tagged/objectbox
Last modified 1yr ago