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 jera
, 1 year ago
This exception has no message.
via Stack Overflow by larsfede
, 2 years ago
This exception has no message.
via GitHub by tony19
, 2 years ago
This exception has no message.
via GitHub by mingfai
, 2 years ago
via GitHub by mingfai
, 9 months ago
via Stack Overflow by Haris Ali
, 2 years ago
This exception has no message.
android.os.NetworkOnMainThreadException: 	at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1147)	at java.net.InetAddress.lookupHostByName(InetAddress.java:418)	at java.net.InetAddress.getLocalHost(InetAddress.java:396)	at jcifs.netbios.NbtAddress.(NbtAddress.java:187)	at jcifs.netbios.NbtAddress.getWINSAddress(NbtAddress.java:533)	at jcifs.UniAddress.(UniAddress.java:62)	at jcifs.smb.SmbFile.getFirstAddress(SmbFile.java:864)	at jcifs.smb.SmbFile.connect(SmbFile.java:951)	at jcifs.smb.SmbFile.connect0(SmbFile.java:880)	at jcifs.smb.SmbFile.open0(SmbFile.java:972)	at jcifs.smb.SmbFile.open(SmbFile.java:1006)	at jcifs.smb.SmbFileOutputStream.(SmbFileOutputStream.java:142)	at jcifs.smb.SmbFileOutputStream.(SmbFileOutputStream.java:97)	at jcifs.smb.SmbFileOutputStream.(SmbFileOutputStream.java:67)	at md5ac18087b2af203d2f41df0f73b22a485.BodyInspectionForm_TabFragment.n_onOptionsItemSelected(Native Method)	at md5ac18087b2af203d2f41df0f73b22a485.BodyInspectionForm_TabFragment.onOptionsItemSelected(BodyInspectionForm_TabFragment.java:47)	at android.app.Fragment.performOptionsItemSelected(Fragment.java:2159)	at android.app.FragmentManagerImpl.dispatchOptionsItemSelected(FragmentManager.java:1988)	at android.app.Activity.onMenuItemSelected(Activity.java:2970)	at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:1136)	at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:761)	at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:152)	at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:904)	at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:894)	at com.android.internal.view.menu.MenuPopupHelper.onItemClick(MenuPopupHelper.java:186)	at android.widget.AdapterView.performItemClick(AdapterView.java:305)	at android.widget.AbsListView.performItemClick(AbsListView.java:1146)	at android.widget.AbsListView$PerformClick.run(AbsListView.java:3057)	at android.widget.AbsListView$3.run(AbsListView.java:3864)	at android.os.Handler.handleCallback(Handler.java:739)	at android.os.Handler.dispatchMessage(Handler.java:95)	at android.os.Looper.loop(Looper.java:139)	at android.app.ActivityThread.main(ActivityThread.java:5298)	at java.lang.reflect.Method.invoke(Native Method)	at java.lang.reflect.Method.invoke(Method.java:372)	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:950)	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745)