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

[v0.90.3] java.lang.NoClassDefFoundError issue with FormatCache on Android 6 and lower #255

Open
papjul opened this issue Nov 19, 2024 · 4 comments

Comments

@papjul
Copy link

papjul commented Nov 19, 2024

As reported by an user in breezy-weather/breezy-weather#1432, xmlutil crashes with the java.lang.NoClassDefFoundError exception on Android 6 and lower. It used to work in v0.90.2.

Let me know if you can't reproduce the issue with a minimum code; I will see if I can help.

@pdvrieze
Copy link
Owner

@papjul Do you use any minification?

The lambda in the case is a function that creates a cache as needed for threadlocals.

As a workaround it should be possible to disable the cache with:

XML {
  policy = DefaultXmlSerializationPolicy(FormatCache.Dummy)
}

Note that this path should avoid ever reading the default as creates the policy without setting a temporary policy.

@pdvrieze
Copy link
Owner

Alternatively you may need to inform proguard to keep that class around.

@papjul
Copy link
Author

papjul commented Nov 19, 2024

I do use minification on release versions. The report from the user is from the non-minified debug version as we can see from the logs. Also, it's specific to Android versions 6 and lower, so it would affect all versions if it was for this reason, right?

pdvrieze added a commit that referenced this issue Nov 19, 2024
an Error fall back to a dummy cache rather than crashing. Addresses #255.
@pdvrieze
Copy link
Owner

@papjul I suspect this is an issue with code lowering/R8. I've just pushed a workaround that will just use a dummy cache if an error is thrown creating the default cache.

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

No branches or pull requests

2 participants