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

Comments

@DennisMuchiri
Copy link

commented Aug 26, 2019

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

This comment has been minimized.

Copy link
Collaborator

commented Aug 26, 2019

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

This comment has been minimized.

Copy link
Collaborator

commented Aug 26, 2019

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

This comment has been minimized.

Copy link
Author

commented Aug 26, 2019

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 was marked as resolved.

Copy link
Author

commented Aug 26, 2019

This is an android studio project. I get this error while trying to rebuild
errodeno

@greenrobot-team

This comment has been minimized.

Copy link
Collaborator

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

This comment has been minimized.

Copy link
Author

commented Aug 26, 2019

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

This comment has been minimized.

Copy link
Author

commented Aug 26, 2019

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

@DennisMuchiri

This comment has been minimized.

Copy link
Author

commented Aug 26, 2019

??

@greenrobot-team

This comment has been minimized.

Copy link
Collaborator

commented Aug 27, 2019

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

This comment has been minimized.

Copy link
Author

commented Aug 27, 2019

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

@greenrobot-team

This comment has been minimized.

Copy link
Collaborator

commented Aug 27, 2019

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

@DennisMuchiri

This comment has been minimized.

Copy link
Author

commented Aug 27, 2019

@greenrobot-team It builds as smooth as silk

@greenrobot-team

This comment has been minimized.

Copy link
Collaborator

commented Aug 27, 2019

Great!

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

@greenrobot

This comment has been minimized.

Copy link
Member

commented Oct 3, 2019

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
Projects
None yet
3 participants
You can’t perform that action at this time.