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

Prevent NoClassDefFoundError crashing app using Sugar #362

Merged
merged 1 commit into from
Dec 7, 2015

Conversation

mitchyboy9
Copy link
Contributor

Hi Satya,

I'm just getting started using Sugar ORM and it looks really good so far. However, I had trouble getting my app to run because I kept getting a NoClassDefFoundError when I included Sugar.

I had a jar file on my classpath which wasn't actually being used by the project. When Sugar tried to load a class from that library, my app crashed.

My guess is that because the library was not being used, the classes didn't actually get copied to the apk, or something like that.

I changed the catch clause in getDomainClass to catch all throwables. It doesn't seem to matter why we can't load a class, the result will be the same: if there is an error of any kind, we're not going to be able to use that class as a domain class.

Thanks,

Alex

…rName can also throw LinkageError and ExceptionInInitializerError.

If we silently ignore a ClassNotFoundException,  I don't see why we wouldn't ignore the others.
A NoClassDefFoundError coming out of this method was causing my application to crash, but it was actually fine that the class couldn't be loaded.
@sibelius
Copy link
Contributor

sibelius commented Dec 7, 2015

@nicolabeghin thanks, I will merge this PR

sibelius added a commit that referenced this pull request Dec 7, 2015
Prevent NoClassDefFoundError crashing app using Sugar
@sibelius sibelius merged commit 7f881a8 into chennaione:master Dec 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants