android.os.NetworkOnMainThreadException

Stack Overflow | Kenny | 8 months ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. Speed up your debug routine!

    Automated exception search integrated into your IDE

  2. 0

    RoadManager error

    GitHub | 3 months ago | Ewrei
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.ewrei.osmtest2/com.example.ewrei.osmtest2.MainActivity}: android.os.NetworkOnMainThreadException
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. android.os.NetworkOnMainThreadException

    No message provided

    at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork()
  2. Android Platform
    StrictMode$AndroidBlockGuardPolicy.onNetwork
    1. android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1303)
    1 frame
  3. Java RT
    InetAddress.getAllByName
    1. java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:86)
    2. java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:74)
    3. java.net.InetAddress.getAllByName(InetAddress.java:752)
    3 frames
  4. okhttp3
    Dns$1.lookup
    1. okhttp3.Dns$1.lookup(Dns.java:39)
    1 frame
  5. okhttp3.internal.connection
    ConnectInterceptor.intercept
    1. okhttp3.internal.connection.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:172)
    2. okhttp3.internal.connection.RouteSelector.nextProxy(RouteSelector.java:138)
    3. okhttp3.internal.connection.RouteSelector.next(RouteSelector.java:80)
    4. okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:178)
    5. okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:129)
    6. okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:98)
    7. okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
    7 frames
  6. okhttp3.internal.http
    RealInterceptorChain.proceed
    1. okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    2. okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
    2 frames
  7. okhttp3.internal.cache
    CacheInterceptor.intercept
    1. okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:109)
    1 frame
  8. okhttp3.internal.http
    RealInterceptorChain.proceed
    1. okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    2. okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
    3. okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
    4. okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    5. okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:124)
    6. okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    7. okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
    7 frames
  9. okhttp3.logging
    HttpLoggingInterceptor.intercept
    1. okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:212)
    1 frame
  10. okhttp3.internal.http
    RealInterceptorChain.proceed
    1. okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    2. okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
    2 frames
  11. com.greenlight.zubie
    ZubieRetrofit$ZubieCallInterceptor.intercept
    1. com.greenlight.zubie.network.ZubieRetrofit$ZubieCallInterceptor.intercept(ZubieRetrofit.java:1063)
    1 frame
  12. okhttp3.internal.http
    RealInterceptorChain.proceed
    1. okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    2. okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
    2 frames
  13. okhttp3
    RealCall.execute
    1. okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:170)
    2. okhttp3.RealCall.execute(RealCall.java:60)
    2 frames
  14. retrofit2
    OkHttpCall.execute
    1. retrofit2.OkHttpCall.execute(OkHttpCall.java:174)
    1 frame
  15. retrofit2.adapter.rxjava
    RxJavaCallAdapterFactory$RequestArbiter.request
    1. retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$RequestArbiter.request(RxJavaCallAdapterFactory.java:171)
    1 frame
  16. rxjava
    OperatorMap$MapSubscriber.setProducer
    1. rx.Subscriber.setProducer(Subscriber.java:211)
    2. rx.internal.operators.OperatorMap$MapSubscriber.setProducer(OperatorMap.java:99)
    3. rx.internal.operators.OperatorMap$MapSubscriber.setProducer(OperatorMap.java:99)
    3 frames
  17. retrofit2.adapter.rxjava
    RxJavaCallAdapterFactory$CallOnSubscribe.call
    1. retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$CallOnSubscribe.call(RxJavaCallAdapterFactory.java:152)
    2. retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$CallOnSubscribe.call(RxJavaCallAdapterFactory.java:138)
    2 frames
  18. rxjava
    OperatorObserveOn$ObserveOnSubscriber.call
    1. rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:50)
    2. rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
    3. rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:50)
    4. rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
    5. rx.Observable.unsafeSubscribe(Observable.java:8666)
    6. rx.internal.operators.OperatorMerge$MergeSubscriber.onNext(OperatorMerge.java:250)
    7. rx.internal.operators.OperatorMerge$MergeSubscriber.onNext(OperatorMerge.java:147)
    8. rx.internal.operators.OperatorMap$MapSubscriber.onNext(OperatorMap.java:74)
    9. rx.internal.operators.OperatorObserveOn$ObserveOnSubscriber.call(OperatorObserveOn.java:227)
    9 frames
  19. rxandroid
    LooperScheduler$ScheduledAction.run
    1. rx.android.schedulers.LooperScheduler$ScheduledAction.run(LooperScheduler.java:107)
    1 frame
  20. Android Platform
    ActivityThread.main
    1. android.os.Handler.handleCallback(Handler.java:751)
    2. android.os.Handler.dispatchMessage(Handler.java:95)
    3. android.os.Looper.loop(Looper.java:154)
    4. android.app.ActivityThread.main(ActivityThread.java:6077)
    4 frames
  21. Java RT
    Method.invoke
    1. java.lang.reflect.Method.invoke(Native Method)
    1 frame
  22. Android
    ZygoteInit.main
    1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
    2. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
    2 frames