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 Stack Overflow by Vaek
, 2 years ago
This exception has no message.
via Stack Overflow by The Ray of Hope
, 2 years ago
via Stack Overflow by nick
, 2 years ago
This exception has no message.
via Stack Overflow by LTKD
, 2 years ago
This exception has no message.
via Stack Overflow by Ahmad Dwaik 'Warlock'
, 2 years ago
This exception has no message.
via Stack Overflow by Samvid Kulkarni
, 2 years ago
android.os.NetworkOnMainThreadException: 	at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1099)	at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:84)	at libcore.io.IoBridge.connectErrno(IoBridge.java:127)	at libcore.io.IoBridge.connect(IoBridge.java:112)	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:459)	at java.net.Socket.connect(Socket.java:842)	at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:119)	at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:144)	at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)	at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)	at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)	at k.k.k.KrishnaActivity.onCreate(KrishnaActivity.java:51)	at android.app.Activity.performCreate(Activity.java:4465)	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)