java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.itesterror/com.example.itesterror.MainActivity}: android.os.NetworkOnMainThreadException

testin.cn | 3 months ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    运行类错误分析

    testin.cn | 3 months ago
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.itesterror/com.example.itesterror.MainActivity}: android.os.NetworkOnMainThreadException
  2. 0

    运行类错误分析

    testin.cn | 6 months ago
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.itesterror/com.example.itesterror.MainActivity}: android.os.NetworkOnMainThreadException
  3. 0

    Android : can't load my XML file and app crashes

    Stack Overflow | 5 years ago | Rob
    android.os.NetworkOnMainThreadException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Java URL getContent Android

    Stack Overflow | 3 years ago | CamelopardalisRex
    android.os.NetworkOnMainThreadException
  6. 0

    Downloading string content of Webpage

    Stack Overflow | 2 years ago
    java.lang.IllegalStateException: Could not execute method of the activity
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:1121)
    1 frame
  3. Java RT
    InetAddress.getAllByName
    1. java.net.InetAddress.lookupHostByName(InetAddress.java:385)
    2. java.net.InetAddress.getAllByNameImpl(InetAddress.java:236)
    3. java.net.InetAddress.getAllByName(InetAddress.java:214)
    3 frames
  4. Android
    HttpURLConnectionImpl.getInputStream
    1. libcore.net.http.HttpConnection.<init>(HttpConnection.java:70)
    2. libcore.net.http.HttpConnection.<init>(HttpConnection.java:50)
    3. libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:340)
    4. libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:87)
    5. libcore.net.http.HttpConnection.connect(HttpConnection.java:128)
    6. libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:315)
    7. libcore.net.http.HttpEngine.connect(HttpEngine.java:310)
    8. libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:289)
    9. libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:239)
    10. libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:273)
    11. libcore.net.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:168)
    11 frames
  5. com.example.itesterror
    MainActivity.onCreate
    1. com.example.itesterror.MainActivity.onCreate(MainActivity.java:45)
    1 frame
  6. Android Platform
    ActivityThread.main
    1. android.app.Activity.performCreate(Activity.java:5045)
    2. android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1101)
    3. android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2031)
    4. android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2092)
    5. android.app.ActivityThread.access$600(ActivityThread.java:133)
    6. android.app.ActivityThread$H.handleMessage(ActivityThread.java:1203)
    7. android.os.Handler.dispatchMessage(Handler.java:99)
    8. android.os.Looper.loop(Looper.java:137)
    9. android.app.ActivityThread.main(ActivityThread.java:4802)
    9 frames
  7. Java RT
    Method.invoke
    1. java.lang.reflect.Method.invokeNative(Native Method)
    2. java.lang.reflect.Method.invoke(Method.java:511)
    2 frames
  8. Android
    ZygoteInit.main
    1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809)
    2. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576)
    2 frames
  9. Android Platform
    NativeStart.main
    1. dalvik.system.NativeStart.main(Native Method)
    1 frame