nats.java icon indicating copy to clipboard operation
nats.java copied to clipboard

Unable to run on Android 7.0 because java.util.Base64

Open zpsw opened this issue 2 years ago • 6 comments

Observed behavior

java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Failed resolution of: Ljava/util/Base64;

Expected behavior

can run on Android 7.0

Server and client version

jnats 2.17.1

Host environment

No response

Steps to reproduce

run on Android 7.0

zpsw avatar Nov 22 '23 11:11 zpsw

@zpsw How does a 4 year old Android version not have part of Java 8? I don't think this is fixable, but I'll welcome any suggestions you might have to fix this.

scottf avatar Nov 22 '23 17:11 scottf

Android 7, named Nougat, is a version from 7 years ago. This version indeed lacks java.util.Base64. My current approach is to fork a copy of the code, extract java.util.Base64, and then replace all references. I'm not sure if this is a good solution. https://stackoverflow.com/questions/55016350/android-nougat-devices-not-supporting-java-util-base64-library image image

zpsw avatar Nov 23 '23 02:11 zpsw

I suppose we could build an interface for the base46 methods we need and then allow the developer to provide an implementation in connection options. Probably should have some sort of unit test that a developer could run to validate base 64 encoding as a black box.

scottf avatar Dec 01 '23 16:12 scottf

@zpsw Do you have an implementation that we could possibly put in the code? If you wrote the code that would be the best, if it's a 3rd party library, even OSS, I'd have to consider it carefully.

scottf avatar Feb 12 '24 17:02 scottf

@zpsw We are currently in discussion to hard fork the repo and port it to api 24. base64 isn't just the only thing in the code that needs to change. I'll try to remember to keep you up to date.

scottf avatar Mar 26 '24 18:03 scottf

I've added possible solution for this issue in the PR #1120.

pwittchen avatar Apr 11 '24 18:04 pwittchen