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

SugarORM doesn't work with multi-dex #267

Closed
gauchito opened this issue Feb 19, 2015 · 8 comments
Closed

SugarORM doesn't work with multi-dex #267

gauchito opened this issue Feb 19, 2015 · 8 comments
Labels

Comments

@gauchito
Copy link

I have a project which uses SugarORM and it was working fine until I enabled multi-dex. After that I've noticed that sometimes the app doesn't create all the db tables in the device. I suspect it's because when it loads dynamically the domain classes, it only picks up the ones in classes.dex and not in the other dex files. So if unfortunately the domain classes are packed in classes2.dex for example, then the db tables for them are not created during start up.

@whoshuu
Copy link
Collaborator

whoshuu commented Apr 7, 2015

Have you tried setting the domain classes field in the manifest? Set it to the topmost package name for the set of models you want to persist. See here:

https://github.com/satyan/sugar/blob/1f49d7c9bfabe72bdcbb02f7639d38d8aee27756/library/src/main/java/com/orm/util/ManifestHelper.java#L21

@whoshuu whoshuu added the bug label Apr 7, 2015
@gauchito
Copy link
Author

gauchito commented Apr 7, 2015

Hi. Thanks for your reply. I already have that field in the manifest indeed. One thing I noticed is that I'm using release 1.3 from maven repository, but it´s a one year old jar with 145 commits behind master. Do you think this bug might be fixed in master already? Why isn't there a new version released? Any known bug in master? I'd prefer to use gradle dependency rather that library project.

@whoshuu
Copy link
Collaborator

whoshuu commented Apr 8, 2015

Give it a test with the master branch and let me know if this bug persists. If it does, I'll do a deeper dive and try to get to the bottom of it.

I understand a gradle dependency is the preferred way of grabbing the library. Unfortunately I believe @satyan is away right now, and he's the only one with write access to maven central for this library.

@tracytheron
Copy link
Contributor

Is this bug fixed now? I met the same issue that Sugar cannot create all tables when I enable multi-dex.

@bendaniel10
Copy link
Contributor

I ran into this issue too, I found out that when MultiDex is enabled, the ReflectionUtil class does not scan all the dex files for entity classes correctly, I think it scans the first one only. I've forked the project and provided a fix for that: https://github.com/bendaniel10/sugar

@tracytheron
Copy link
Contributor

@bendaniel10 yes, that's the issue. I fixed it few months ago, but @satyan perhaps is away. #327

@Vookash
Copy link
Contributor

Vookash commented Oct 22, 2015

Is it fixed? I have version 1.4 and still have this problem.

@sibelius
Copy link
Contributor

@bendaniel10 could you provide a pull request to fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants