Repository navigation
Fix the crash on older Android versions without desugaring - #381
Open
Keith-wright wants to merge 2 commits into
Open
Keith-wright wants to merge 2 commits into
Keith-wright wants to merge 2 commits into
Conversation
Since 2.4.1 the connection passed events through java.util.function.Consumer, which only exists on Android 7 (API 24) and later. On API 21 to 23 the lambda that implements it fails to load, so creating Pusher threw NoClassDefFoundError unless the app enabled core library desugaring. Use a library interface instead, so the client runs on Android 5 (API 21) and later without desugaring, as it did before 2.4.1. Fixes #366
aonemd
reviewed
Oct 22, 2026
aonemd
left a comment
Member
There was a problem hiding this comment.
Why do we need this? Both Android 5 and 6 support has ended by Google.
Android 5 and 6 are past Google's support, and current AndroidX libraries default to minSdk 24, so don't advertise them as supported. The code change still removes the crash on older versions.
Contributor
Author
|
@aonemd You’re right. I’ve reverted the README change, so it still says Android 7 and above, and I’ve updated the PR title to match. The code change is still worth keeping. java.util.function.Consumer was added in API 24, so since 2.4.1 the library has crashed on older versions without desugaring (#366). An internal interface fixes that, with no change on Android 7 and up. This PR also carries the #288 fix from #349 for the next release. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes #366. Since 2.4.1, the library has used java.util.function.Consumer, which only exists on Android 7 and later, so creating Pusher crashed on older versions without core library desugaring. This replaces it with an internal interface. The README is unchanged.
Requesting the release-patch label for 2.4.6.
CHANGELOG