-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Problem with java.xml.bind.DatatypeConverter #18
Comments
Does Android have a Base64 encoder/decoder that can be plugged in? |
In other words, DatatypeConverter is available out-of-the-box on standard JVMs. If Android JVMs do not have this, is there an alternative that you might recommend? |
Hey, thanks for the prompt reply, I'm not sure honestly, but android uses some kind of android.util.Base64, would you be able to plug that in as an alternate to the java class causing the error? Thanks again, |
https://bitbucket.org/connect2id/nimbus-jose-jwt/issue/52/library-does-not-work-on-android-b-c-of I don't know if that will help. |
I'm seeing this problem as well. I think the Base64 class is what is needed. There probably needs to be either an interface or a run-time detection mechanism for switching to the Android implementation. |
Also, here's a public domain implementation that you could include in the library. |
Is this the only thing required to make it work on Android? Or will there be more work necessary? |
I believe that's all that's needed to make it work on Android |
…onments. This still needs to be tested in a real Android project.
I just added a quick fix for this in the android branch. Can someone please build and test this out on an Android project and let me know how it goes? You should just be able to:
dependencies {
compile 'io.jsonwebtoken:jjwt:0.5-SNAPSHOT'
} (and don't forget to ensure that your local disk maven repo is enabled in your android build config): repositories {
mavenLocal()
mavenCentral()
} If someone can confirm this works on Android (both JWT building and parsing), I can cut a follow up 0.5 release that can be used on both standard JVMs and Android :) |
@lhazlewood awesome, thanks for this, will provide you feedback as soon as I'm able to test it. |
@rhyscoronado sounds good - thanks! |
Just curious - has anyone been able to try this fix out on Android yet? |
@rhyscoronado or @abrodersen can you please confirm if this works or not? I want to release 0.5 and would like this in if it works. Thanks. |
hI @lhazlewood apologies for the late testing, I managed to generate from the device, but there are warning messages. 04-29 17:43:35.284 13254-13254/com.nelsoft.easyshop I/dalvikvm﹕ Could not find method javax.xml.bind.DatatypeConverter.parseBase64Binary, referenced from method io.jsonwebtoken.impl.Base64Codec.decode I don't know if it's affecting something, but it's working now. Thanks! :) |
Let me try to fix that - should be quick. |
@rhyscoronado I just pushed a change to the |
…perty check. This is to ensure that, during tests, the stub android .jar isn't used since it is in the classpath.
Had to make one more change - if the CI build passes, we should test this latest one. |
The CI build tested fine - @rhyscoronado if you can confirm this latest change, I can cut the release. |
@rhyscoronado I'd like to release today if you can confirm if this works. |
…wn class. Created a factory that can return either depending on environment. Ensured all code other than the lang package is at 100% test coverage.
Since I've received no confirmation from the parties in this thread, I'm releasing the fix implemented in PR #29, now merged in master and I believe to work. Any other concerns can be raised in a new issue. |
Hi, I'm having issue with using this on android, the following fatal exception occurs:
java.lang.NoClassDefFoundError: javax.xml.bind.DatatypeConverter
at io.jsonwebtoken.impl.Base64Codec.encode(Base64Codec.java:24)
and found out Android doesn't support javax.xml.bind.DatatypeConverter.
Any possible fix for this? Thanks.
The text was updated successfully, but these errors were encountered: