wasync
wasync copied to clipboard
wasync not working for Android API Level < 25
Hi there!
I am using wasync 2.3.1 in my current Project and everything worked fine till I tried my app on an API-Level < 25.
My app crashes when creating the socket from the client because of an java.lang.VerifyError
for JDKAsyncHttpProvider
.
Example Code:
AtmosphereClient client = ClientFactory.getDefault().newClient(AtmosphereClient.class);
RequestBuilder request = client.newRequestBuilder()
.method(Request.METHOD.GET)
.uri("" + "/suspend")
.enableProtocol(true)
.transport(Request.TRANSPORT.LONG_POLLING);
Socket socket = client.create(); // <--- here it crashes!!!
try {
socket.on(new Function<Reader>() {
@Override
public void on(Reader r) {
// Read the response
Log.d("WebSocket", "response");
}
}).on(new Function<IOException>() {
@Override
public void on(IOException ioe) {
// Some IOException occurred
Log.d("WebSocket", "IOException");
}
}).open(request.build()).fire("echo").fire("bong");
} catch (IOException e) {
e.printStackTrace();
}
I also tried many other Client
implementations, but always with the same result.
I get following stacktrace:
java.lang.VerifyError: com/ning/http/client/providers/jdk/JDKAsyncHttpProvider
at com.ning.http.client.AsyncHttpClient.loadDefaultProvider(AsyncHttpClient.java:591)
at com.ning.http.client.AsyncHttpClient.<init>(AsyncHttpClient.java:187)
at org.atmosphere.wasync.impl.ClientUtil.createDefaultAsyncHttpClient(ClientUtil.java:51)
at org.atmosphere.wasync.impl.ClientUtil.createDefaultAsyncHttpClient(ClientUtil.java:38)
at org.atmosphere.wasync.impl.ClientUtil.create(ClientUtil.java:76)
at org.atmosphere.wasync.impl.AtmosphereClient.create(AtmosphereClient.java:41)
at ...
After unsuccessfully reading several threads and wasting much time, I just downgraded wasync to 2.1.2 and the error was gone but other issues occured.
Furthermore I tried the official android-chat with the same result.
I also unsuccessfully tested this with other AHC Provider (Grizzly, Netty).
Here is a table with all the results for each wAsync Version and Android API Level I have tried:
wAsync Version | Android API Level | Result |
---|---|---|
2.1.3 | 25 | yes |
2.1.3 | 23 | No virtual methos setEndpointIdentificationAlgorithm(Ljava/lang/String;) in class Ljavax/net/ssl/SSLParameters; ... |
2.1.3 | 19 | java.lang.VerifyError: com/ning/http/client/providers/jdk/JDKAsyncHttpProvider |
2.1.3 | 17 | java.lang.VerifyError: com/ning/http/client/providers/jdk/JDKAsyncHttpProvider |
2.1.2 | 25 | yes |
2.1.2 | 19 | NoSuchMethodError javax.net.ssl.SSLParameters.sendEndpointIdentificationAlgorithm |
2.1.2 | 17 | java.lang.NullPointerException: ssl == null / java.lang.ExceptionInInitializerError |
2.1.0 | 19 | NoSuchMethodError javax.net.ssl.SSLParameters.sendEndpointIdentificationAlgorithm |
1.4.3 | 25 | java.lang.NullPointerException: ssl == null |
1.4.3 | 23 | java.lang.NullPointerException: ssl == null |
1.4.3 | 19 | java.io.IOException: Remotely Closed |
1.4.3 | 17 | java.io.IOException: Remotely Closed |
I am facing exactly same problems. Have you guys found out the solution?
Unfortunately no 😢
We just used Version 1.4.3 because it was the most stable one for our API Level range.
We could handle the java.io.IOException: Remotely Closed
Exception, because it was just thrown because of an self signed certificate on server side.
I am still waiting for any feedback 🙄
I think the supported minimum should be API 19