After creating tables and rebuilding error: code too large error occurs and highlights the following method
private static byte[] getModel() {
//HAS 6352 LINES
}
Thanks for reporting. Is this an Android project? Could you share the exact error message so we can research this properly? Can you share what you are doing (e.g. Rebuild project or the name of the Gradle task you are executing?).
OK, looks like this is about MyObjectBox.getModel().
Java has a method size limit. https://stackoverflow.com/a/17422590/9187282
@DennisMuchiri Do you have a lot of @Entity classes? Or do you have an @Entity with many properties? As a temporary workaround you can try to remove @Entity classes or remove properties, depending on which case.
Thank you for the quick reply I have many @Entity classes since my app is big. Is there a way I acan split up the getModel() function?
This is an android studio project. I get this error while trying to rebuild

Is there a way I acan split up the getModel() function?
No, this is something we would have to change in the ObjectBox Gradle plugin. Until this is fixed you have to remove an @Entity to build successfully.
Or you could create a separate module and create another ObjectBox database there (separate @Entity and MyObjectBox class).
The plugin is open source. What I meant is if I can create a branch where I can do changes on the plugin with your guidance to fix the issue.
@greenrobot-team My database has many relationships. It will be a challenge to have two databases in the same app.
??
We have created a fix and built a preview release of the ObjectBox Gradle plugin for you. In your root build.gradle file change the version to:
classpath "io.objectbox:objectbox-gradle-plugin:2.3.5-rc1"
Only change the version of the plugin. Keep any other ObjectBox dependencies, like objectbox-android, you have added at 2.3.4.
Then sync and rebuild your project.
Let us know if this fixes your issue.
@greenrobot @greenrobot-team Thank you. Looking forward to version 2.3.5.
@DennisMuchiri So does your project build successfully when using 2.3.5-rc1 of objectbox-gradle-plugin?
@greenrobot-team It builds as smooth as silk
Great!
This issue was fixed internally and will be released with an upcoming update.
This is also part of the just released version '2.4.0-RC' - would be great if you could give it a try and report back. Thank you!