Replace javax.xml.bind.DatatypeConverter with java.util.Base64 for Java 9+ compatibility#33
Open
ognjenvujovic04 wants to merge 2 commits intoa1aw:masterfrom
Open
Replace javax.xml.bind.DatatypeConverter with java.util.Base64 for Java 9+ compatibility#33ognjenvujovic04 wants to merge 2 commits intoa1aw:masterfrom
ognjenvujovic04 wants to merge 2 commits intoa1aw:masterfrom
Conversation
…va 9+ and Android compatibility
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.
Description
This PR addresses the issue where the library fails to run on Android and newer versions of Java (Java 9+) due to the use of
javax.xml.bind.DatatypeConverter, which has been removed in newer Java versions and is not available in Android's runtime. The changes replacejavax.xml.bind.DatatypeConverterwithjava.util.Base64, which is compatible with Android, Java SE, and newer versions of Java.Changes:
DatatypeConverter.parseBase64Binary()withBase64.getDecoder().decode()DatatypeConverter.printBase64Binary()withBase64.getEncoder().encodeToString()Why is this change necessary?
javax.xml.bind.DatatypeConverteris not available in Android, causing aNoClassDefFoundErrorwhen the library is used in Android apps.javax.xml.bind.DatatypeConverterhas been removed in Java 9 and later, making the library incompatible with newer Java versions.java.util.Base64is a standard Java class available in both Android and Java SE (including newer versions), making the library more versatile and future-proof.Testing:
NoClassDefFoundError.Related Issue: