android.os.NetworkOnMainThreadException

Exception #2484207

Samebug tips0

We couldn't find tips for this exception.

Don't give up yet. Paste your full stack trace to get a solution.

Solutions on the web1167

  • via GitHub by tuhin10
    ,
  • Stack trace

    • android.os.NetworkOnMainThreadException at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1147) at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:249) at libcore.io.IoBridge.recvfrom(IoBridge.java:553) at java.net.PlainSocketImpl.read(PlainSocketImpl.java:485) at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:37) at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:237) at okio.Okio$2.read(Okio.java:139) at okio.AsyncTimeout$2.read(AsyncTimeout.java:211) at okio.RealBufferedSource.read(RealBufferedSource.java:50) at okhttp3.internal.http.Http1xStream$FixedLengthSource.read(Http1xStream.java:381) at okhttp3.internal.Util.skipAll(Util.java:178) at okhttp3.internal.Util.discard(Util.java:160) at okhttp3.internal.http.Http1xStream$FixedLengthSource.close(Http1xStream.java:397) at okio.RealBufferedSource.close(RealBufferedSource.java:396) at okio.ForwardingSource.close(ForwardingSource.java:43) at okio.RealBufferedSource.close(RealBufferedSource.java:396) at okio.RealBufferedSource$1.close(RealBufferedSource.java:384) at com.testapp.apkinstall.MainActivity.writeResponseBodyToDisk(MainActivity.java:87) at com.testapp.apkinstall.MainActivity.access$000(MainActivity.java:24) at com.testapp.apkinstall.MainActivity$1$1.onResponse(MainActivity.java:42) at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run(ExecutorCallAdapterFactory.java:68) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5254) 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:898) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)

    Write tip

    You have a different solution? A short tip here would help you and many other users who saw this issue last week.

    Users with the same issue

    jkjk
    8 times, last one
    adawolfsadawolfs
    Once,
    Unknown visitor
    Unknown visitorOnce,
    MyInnosMyInnos
    3 times, last one
    Hiren AmaliyarHiren Amaliyar
    3 times, last one
    38 more bugmates