Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Samebug tips

  1. ,
    via Stack Overflow by Razgriz

    Happens when you make a network call on the main UI thread of the Android application which results in a UI freeze until the network call is complete and the response is received. Instead, execute the network calls in the background: use AsyncTask.

  2. ,

    An alternative for just getting rid of the Exception is use StrictMode.ThreadPolicy to force execute on main thread.

    StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
    StrictMode.setThreadPolicy(policy);
    

Solutions on the web

via GitHub by jhansche
, 1 year ago
via GitHub by jhansche
, 11 months ago
via Stack Overflow by pedro.olimpio
, 2 years ago
This exception has no message.
via GitHub by Cyclu
, 2 years ago
android.os.NetworkOnMainThreadException: 	at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1273)	at com.android.org.conscrypt.OpenSSLSocketImpl.shutdownAndFreeSslNative(OpenSSLSocketImpl.java:1131)	at com.android.org.conscrypt.OpenSSLSocketImpl.close(OpenSSLSocketImpl.java:1126)	at android.gov.nist.javax.sip.stack.TLSMessageChannel.close(TLSMessageChannel.java:180)	at android.gov.nist.javax.sip.stack.ConnectionOrientedMessageChannel.close(ConnectionOrientedMessageChannel.java:127)	at android.gov.nist.javax.sip.stack.TLSMessageProcessor.stop(TLSMessageProcessor.java:225)	at android.gov.nist.javax.sip.SipProviderImpl.removeListeningPoints(SipProviderImpl.java:1082)	at android.gov.nist.javax.sip.SipStackImpl.deleteSipProvider(SipStackImpl.java:1691)	at org.mobicents.restcomm.android.sipua.impl.SipManager.unbind(SipManager.java:282)	at org.mobicents.restcomm.android.sipua.impl.SipManager.shutdown(SipManager.java:265)	at org.mobicents.restcomm.android.sipua.impl.DeviceImpl.Shutdown(DeviceImpl.java:143)	at org.mobicents.restcomm.android.client.sdk.RCDevice$1.run(RCDevice.java:278)	at android.os.Handler.handleCallback(Handler.java:739)	at android.os.Handler.dispatchMessage(Handler.java:95)	at android.os.Looper.loop(Looper.java:148)	at android.app.ActivityThread.main(ActivityThread.java:5466)	at java.lang.reflect.Method.invoke(Native Method)	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)