Skip to content

Conversation

@ognjenvujovic04
Copy link

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 replace javax.xml.bind.DatatypeConverter with java.util.Base64, which is compatible with Android, Java SE, and newer versions of Java.

Changes:

  • Replaced DatatypeConverter.parseBase64Binary() with Base64.getDecoder().decode()
  • Replaced DatatypeConverter.printBase64Binary() with Base64.getEncoder().encodeToString()

Why is this change necessary?

  • javax.xml.bind.DatatypeConverter is not available in Android, causing a NoClassDefFoundError when the library is used in Android apps.
  • javax.xml.bind.DatatypeConverter has been removed in Java 9 and later, making the library incompatible with newer Java versions.
  • java.util.Base64 is a standard Java class available in both Android and Java SE (including newer versions), making the library more versatile and future-proof.

Testing:

  • The changes were tested on an Android app, and the library now works without throwing the NoClassDefFoundError.
  • The changes were also tested on a Java SE environment (Java 17) to ensure compatibility with newer Java versions.
  • Existing functionality was verified to ensure no regressions were introduced.

Related Issue:

  • Fixes #123 (if there is an existing issue, link it here)

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.

1 participant