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 Appcelerator JIRA by Stefan Axelsson, 1 year ago
Unable to start activity ComponentInfo{com.derp.herp/com.derp.herp.HerpderpActivity}: android.os.NetworkOnMainThreadException
via Appcelerator JIRA by Stefan Axelsson, 1 year ago
Unable to start activity ComponentInfo{com.derp.herp/com.derp.herp.HerpderpActivity}: android.os.NetworkOnMainThreadException
via Stack Overflow by chriswins2much
, 2 years ago
Unable to start activity ComponentInfo{com.chriswins2much.Util/com.chriswins2much.Util.LogMeInClientActivity}: android.os.NetworkOnMainThreadException
via Stack Overflow by user98239820
, 2 years ago
Unable to start activity ComponentInfo{org.yipl.rssfeed/org.yipl.rssfeed.News}: android.os.NetworkOnMainThreadException
via Stack Overflow by fsdf fsd
, 1 year ago
Unable to start activity ComponentInfo{com.example.market/com.example.market.MainActivity}: android.os.NetworkOnMainThreadException
via Stack Overflow by Liberi
, 1 year ago
Unable to start activity ComponentInfo{com.example.slideoutmenu/com.example.slideoutmenu.ListViewActivity}: android.os.NetworkOnMainThreadException
android.os.NetworkOnMainThreadException: 	at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1117)	at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:163)	at libcore.io.IoBridge.recvfrom(IoBridge.java:513)	at java.net.PlainSocketImpl.read(PlainSocketImpl.java:488)	at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:46)	at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:240)	at org.appcelerator.kroll.common.TiFastDev$Session.blockRead(TiFastDev.java:310)	at org.appcelerator.kroll.common.TiFastDev$Session.readInt(TiFastDev.java:349)	at org.appcelerator.kroll.common.TiFastDev$Session.readTokenCount(TiFastDev.java:412)	at org.appcelerator.kroll.common.TiFastDev.openInputStream(TiFastDev.java:214)	at org.appcelerator.kroll.util.KrollAssetHelper.readAsset(KrollAssetHelper.java:53)	at org.appcelerator.titanium.TiLaunchActivity.loadActivityScript(TiLaunchActivity.java:104)	at org.appcelerator.titanium.TiLaunchActivity.windowCreated(TiLaunchActivity.java:152)	at org.appcelerator.titanium.TiRootActivity.windowCreated(TiRootActivity.java:109)	at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:502)	at org.appcelerator.titanium.TiLaunchActivity.onCreate(TiLaunchActivity.java:145)	at org.appcelerator.titanium.TiRootActivity.onCreate(TiRootActivity.java:97)	at android.app.Activity.performCreate(Activity.java:5008)	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)	at android.app.ActivityThread.access$600(ActivityThread.java:130)	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)	at android.os.Handler.dispatchMessage(Handler.java:99)	at android.os.Looper.loop(Looper.java:137)	at android.app.ActivityThread.main(ActivityThread.java:4745)	at java.lang.reflect.Method.invokeNative(Native Method)	at java.lang.reflect.Method.invoke(Method.java:511)	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)	at dalvik.system.NativeStart.main(Native Method)