Pattern selector

Most relevant patterns first. Most helpful ones displayed. Click here to show all.

  1. RealCall.execute() has thrown a NetworkOnMainThreadException
    OkHttp
    5
    2
    0
  2. Executed network call on the main thread
    Android
    876
    145
    13

Your stack trace compared to the selected pattern

Jump to solutionsExpand frames
android.os.NetworkOnMainThreadException
    at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1448)
    at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:102)
    at java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:90)
    at java.net.InetAddress.getAllByName(InetAddress.java:787)
25 frames hidden

Solution

Larten6 months ago

You must execute network calls on a background thread and not on the main thread.

Read more: https://developer.android.com/training/articles/perf-anr

External results for this pattern (10)

  1. Daniel Gugervia Google Groups1 month ago
    No message found for this stack trace.
    Show stack trace
  2. Abianue1via GitHub1 month ago
    No message found for this stack trace.
    Show stack trace
  3. flatfishervia GitHub2 months ago
    No message found for this stack trace.
    Show stack trace
  4. kordianbruckvia GitHub2 months ago
    No message found for this stack trace.
    Show stack trace
  5. blurpyvia GitHub3 months ago
    No message found for this stack trace.
    Show stack trace
  6. casic71via GitHub3 months ago
    No message found for this stack trace.
    Show stack trace
  7. bkhezryvia GitHub3 months ago
    No message found for this stack trace.
    Show stack trace
  8. rezaf28via GitHub3 months ago
    No message found for this stack trace.
    Show stack trace
  9. Dr-Faustvia GitHub3 months ago
    No message found for this stack trace.
    Show stack trace
  10. No message found for this stack trace.
    Show stack trace