I am developing an android app on localhost using Socket io.
I works fine when I test it on android 8.1 and android 4.4. But when I experimented with Android 9.0, I couldn't connect to localhost.
Error "io.socket.engineio.client.EngineIOException: xhr poll error".
Note: I don't use SSL
(build.gradle.dependencies)
implementation ('io.socket:socket.io-client:1.0.0') {
exclude group: 'org.json', module: 'json'
}
Where the error returns
client = IO.socket("http://localhost:3000");
...
client.on(Socket.EVENT_CONNECT_ERROR, new Emitter.Listener() {
@Override
public void call(final Object... args) {
for (int i = 0; i < args.length; i++) {
Log.d(TAG, args[i]);
// io.socket.engineio.client.EngineIOException: xhr poll error
}
}
});
...
client.connect();