Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: code too large #750

Closed
DennisMuchiri opened this issue Aug 26, 2019 · 14 comments
Closed

error: code too large #750

DennisMuchiri opened this issue Aug 26, 2019 · 14 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@DennisMuchiri
Copy link

After creating tables and rebuilding error: code too large error occurs and highlights the following method
private static byte[] getModel() {
//HAS 6352 LINES
}

@greenrobot-team
Copy link
Member

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?).

@greenrobot-team
Copy link
Member

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.

@DennisMuchiri
Copy link
Author

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?

@DennisMuchiri

This comment has been minimized.

@greenrobot-team
Copy link
Member

greenrobot-team commented Aug 26, 2019

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).

@greenrobot-team greenrobot-team added the bug Something isn't working label Aug 26, 2019
@greenrobot-team greenrobot-team added this to the 2.4.0 milestone Aug 26, 2019
@greenrobot-team greenrobot-team self-assigned this Aug 26, 2019
@DennisMuchiri
Copy link
Author

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.

@DennisMuchiri
Copy link
Author

@greenrobot-team My database has many relationships. It will be a challenge to have two databases in the same app.

@DennisMuchiri
Copy link
Author

??

@greenrobot-team
Copy link
Member

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.

@DennisMuchiri
Copy link
Author

@greenrobot @greenrobot-team Thank you. Looking forward to version 2.3.5.

@greenrobot-team
Copy link
Member

@DennisMuchiri So does your project build successfully when using 2.3.5-rc1 of objectbox-gradle-plugin?

@DennisMuchiri
Copy link
Author

@greenrobot-team It builds as smooth as silk

@greenrobot-team
Copy link
Member

Great!

This issue was fixed internally and will be released with an upcoming update.

@greenrobot
Copy link
Member

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants