Fatal Exception: java.lang.NullPointerException

mbedial

Member
Hi

We are getting so many
"Fatal Exception: java.lang.NullPointerException
Attempt to invoke virtual method 'void com.flashphoner.fpwcsapi.webrtc.MediaConnection.setMediaConnectionListener(com.flashphoner.fpwcsapi.webrtc.MediaConnectionListener)' on a null object reference"

in our Android users. The sdk used is wcs-android-sdk-1.0.1.35-release. Do you know how to debug this? We are unable to reproduce it. Any idea?

Stack:

com.flashphoner.fpwcsapi.session.Call$1.run (Call.java:173)
android.os.Handler.handleCallback (Handler.java:883)
android.os.Handler.dispatchMessage (Handler.java:100)
android.os.Looper.loop (Looper.java:214)
com.flashphoner.fpwcsapi.util.LooperExecutor.run (LooperExecutor.java:44)

Also another typical crash is

Fatal Exception: org.java_websocket.exceptions.WebsocketNotConnectedException

org.java_websocket.WebSocketImpl.send (WebSocketImpl.java:573)
org.java_websocket.WebSocketImpl.send (WebSocketImpl.java:550)
org.java_websocket.client.WebSocketClient.send (WebSocketClient.java:145)
com.flashphoner.fpwcsapi.ws.WebSocketChannelClient$2.run (WebSocketChannelClient.java:116)
android.os.Handler.handleCallback (Handler.java:873)
android.os.Handler.dispatchMessage (Handler.java:99)
android.os.Looper.loop (Looper.java:201)
com.flashphoner.fpwcsapi.util.LooperExecutor.run (LooperExecutor.java:44)


Thanks in advance
 

mbedial

Member
Thanks Max,

Hi,Still having sometimes this issue with version 1.0.1.77:Fatal Exception: java.lang.NullPointerException
Attempt to invoke virtual method 'void com.flashphoner.fpwcsapi.webrtc.MediaConnection.setMediaConnectionListener(com.flashphoner.fpwcsapi.webrtc.MediaConnectionListener)' on a null object reference
com.flashphoner.fpwcsapi.session.Call$1.run (Call.java:171)
android.os.Handler.handleCallback (Handler.java:751)
android.os.Looper.loop (Looper.java:154)
com.flashphoner.fpwcsapi.util.LooperExecutor.run (LooperExecutor.java:44)and also other one:Fatal Exception: org.java_websocket.exceptions.WebsocketNotConnectedException
org.java_websocket.WebSocketImpl.send (WebSocketImpl.java:573)
org.java_websocket.WebSocketImpl.send (WebSocketImpl.java:550)
org.java_websocket.client.WebSocketClient.send (WebSocketClient.java:145)
com.flashphoner.fpwcsapi.ws.WebSocketChannelClient$2.run (WebSocketChannelClient.java:120)
android.os.Handler.handleCallback (Handler.java:883)
android.os.Looper.loop (Looper.java:224)
com.flashphoner.fpwcsapi.util.LooperExecutor.run (LooperExecutor.java:44)

BR
 

Max

Administrator
Staff member
Please check if you are using Android SDK 1.0 on Android 5-7 devices only. On Android 8 and higher, use Android SDK 1.1 (latest build 1.1.0.27).
Please also check if network is good enough, this can happen due to Websocket connection interruption.
 
Last edited:

mbedial

Member
Thanks a lot for your quick answer.
Actually although we are only using 1.0.1.77 (otherwise the apk is 20 mb heavier ) , the crash happens in both SDKs and in all android devices, so it seems that it doesn't depend on it.
Regarding the network, I guess that it'll depend on the user access, since we have a good connection in our DC. Anyway, can a potential connection interruption to generate a crash? How could we al least to avoid the crash?

Thanks in advance.
 

Max

Administrator
Staff member
Regarding the network, I guess that it'll depend on the user access, since we have a good connection in our DC. Anyway, can a potential connection interruption to generate a crash? How could we al least to avoid the crash?
You should handle Session.onDisconnection event to check if Websocket connection is interrupted, please see example on GitHub:
Code:
                    /**
                     * Callback functions for session status events are added to make appropriate changes in controls of the interface when connection is established and closed.
                     */
                    session.on(new SessionEvent() {
                        @Override
                        public void onConnected(final Connection connection) {
                            ...
                        }

                        @Override
                        public void onDisconnection(final Connection connection) {
                            runOnUiThread(new Runnable() {
                                @Override
                                public void run() {
                                    // do the disconnection job and prevent from stream publishing or playback
                                }
                            });
                        }
                    });
 
Top