benwtrent / janus-gateway-android

This is an API wrapper that utilizes the native WebRTC build and is made to ease communication with the janus-gateway
MIT License
112 stars 73 forks source link

AsyncServer error #15

Open Alvinhx opened 8 years ago

Alvinhx commented 8 years ago

Hi, I just downloaded the code the code and tried to run it on Android 6.0.1. it crashed at app starting.

FATAL EXCEPTION: AsyncServer Process: computician.janusclient, PID: 18065 java.lang.NullPointerException: Attempt to invoke interface method 'void com.koushikdutta.async.http.WebSocket.setWriteableCallback(com.koushikdutta.async.callback.WritableCallback)' on a null object reference at computician.janusclientapi.JanusWebsocketMessenger$1.onCompleted(JanusWebsocketMessenger.java:48) at com.koushikdutta.async.http.AsyncHttpClient$11.onConnectCompleted(AsyncHttpClient.java:685) at com.koushikdutta.async.http.AsyncHttpClient.reportConnectedCompleted(AsyncHttpClient.java:169) at com.koushikdutta.async.http.AsyncHttpClient.access$200(AsyncHttpClient.java:50) at com.koushikdutta.async.http.AsyncHttpClient$3.onConnectCompleted(AsyncHttpClient.java:280) at com.koushikdutta.async.AsyncServer.runLoop(AsyncServer.java:812) at com.koushikdutta.async.AsyncServer.run(AsyncServer.java:627) at com.koushikdutta.async.AsyncServer.access$700(AsyncServer.java:41) at com.koushikdutta.async.AsyncServer$13.run(AsyncServer.java:569)

I don't quite understand why is it. Can you check on it? thanks!!

benwtrent commented 8 years ago

So, it looks like it tried to write to a null object? Looks like you are using the websocket endpoint right?

Does it work on an earlier release? Before the code changes pushed by @georgekankava?

Alvinhx commented 8 years ago

Yes. I'm using websocket endpoint. And I didn't know if it works before, this is my first time using it. I'm checking my server now..maybe if's my server's problem.

On Mon, Apr 4, 2016 at 9:27 PM, Benjamin Trent notifications@github.com wrote:

So, it looks like it tried to write to a null object? Looks like you are using the websocket endpoint right?

Does it work on an earlier release? Before the code changes pushed by @georgekankava https://github.com/georgekankava?

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/Computician/janus-gateway-android/issues/15#issuecomment-205580379

pookie13 commented 7 years ago

@Alvinhx, We are also facing the same problem. Was that problem from the server side or due to slow internet connection speed. Please let us know the solution.

Right now we are checking client is null or not before making it writable. if I found that client is null then I am resending connect() function again until it connects. As it is not the proper solution because sometimes it takes too many attempts to get register your help will be very helpful to us.

MrsZ commented 7 years ago

hi,We are also facing the same problem. Have you solved this problem?How should I deal with this problem? Thanks。

benwtrent commented 7 years ago

@MrsZ have you tried using the HTTP Client? Or does this happen there as well?

benwtrent commented 7 years ago

https://github.com/Computician/janus-gateway-android/blob/master/janusclientapi/src/main/java/computician/janusclientapi/JanusWebsocketMessenger.java#L45

That line, it seems that if an exception has occurred, we should not continue this code path and fail. It may be that there is an exception being returned by the Async client that we are not seeing.

MrsZ commented 7 years ago

Yes, do you know how to solve this problem now? My android technology is relatively poor, very hope you can solve this problem. Thanks for your Hard work。

benwtrent commented 7 years ago

I am not sure, you could easily check if that exception is null or not and log it to see if we get some more information.

Log.d("JANUSCLIENT", ex.toString()); or Log.d("JANUSCLIENT", Log.getStackTraceString(ex));. I would also return after seeing that the exception is NOT null.

May also have to step through it with a debugger.