java.net.http.HttpClient not compatible with Android
I'm getting this when the library running on Android attempts to connect:
05-11 16:31:08.623 E/AndroidRuntime(21464): java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Failed resolution of: Ljava/net/http/HttpClient;
Full error output: https://gist.github.com/kuiperanon/b20ac52ff97e3cda52c44ceb94a10b29
I think we could make ConnectionImpl.java into a service that could replaced using different providers, and then one provider could be compatible with Android. Or should we just find a solution that is compatible with everything?
I'll post a PR where I replace java.net.http with OKHttp and see what you think @tcheeric
Great. Send your PR against the 0.6.1-SNAPSHOT branch.
I think the OkHttp library might be limited to only work with urls with the http or https scheme.
https://square.github.io/okhttp/5.x/okhttp/okhttp3/-ok-http-client/new-web-socket.html
https://square.github.io/okhttp/5.x/okhttp/okhttp3/-request/index.html
https://square.github.io/okhttp/5.x/okhttp/okhttp3/-http-url/index.html
HttpUrl:
this class only supports
httpandhttps
EDIT: Nevermind, I found out that I can just replace wss with https, etc.
Here's my current draft of the PR. https://github.com/tcheeric/nostr-java/pull/166
I shouldn't have closed this until this is done and merged: https://github.com/tcheeric/nostr-java/pull/168