我正在编写一个显示来自网站的数据的小应用程序。数据以 json 字符串形式提供。我有 3 项活动很好。现在我更改了一项活动的代码并想对其进行测试。但从那时起,所有活动都不再起作用,我没有发现调试器的错误。也许有人可以帮助我使用 logcat。
谢谢
08-23 08:17:09.600: E/Trace(641): error opening trace file: No such file or directory (2)
08-23 08:17:10.368: D/dalvikvm(641): GC_FOR_ALLOC freed 93K, 2% free 10954K/11143K, paused 60ms, total 64ms
08-23 08:17:10.738: D/gralloc_goldfish(641): Emulator without GPU emulation detected.
08-23 08:17:32.118: D/AndroidRuntime(641): Shutting down VM
08-23 08:17:32.118: W/dalvikvm(641): threadid=1: thread exiting with uncaughtexception (group=0x40a13300)
08-23 08:17:32.260: E/AndroidRuntime(641): FATAL EXCEPTION: main
08-23 08:17:32.260: E/AndroidRuntime(641): java.lang.RuntimeException: Unable to start activity ComponentInfo{de.damps.fantasy/de.damps.fantasy.scoresActivity}: android.os.NetworkOnMainThreadException
08-23 08:17:32.260: E/AndroidRuntime(641): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
08-23 08:17:32.260: E/AndroidRuntime(641): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
08-23 08:17:32.260: E/AndroidRuntime(641): at android.app.ActivityThread.access$600(ActivityThread.java:130)
08-23 08:17:32.260: E/AndroidRuntime(641): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
08-23 08:17:32.260: E/AndroidRuntime(641): at android.os.Handler.dispatchMessage(Handler.java:99)
08-23 08:17:32.260: E/AndroidRuntime(641): at android.os.Looper.loop(Looper.java:137)
08-23 08:17:32.260: E/AndroidRuntime(641): at android.app.ActivityThread.main(ActivityThread.java:4745)
08-23 08:17:32.260: E/AndroidRuntime(641): at java.lang.reflect.Method.invokeNative(Native Method)
08-23 08:17:32.260: E/AndroidRuntime(641): at java.lang.reflect.Method.invoke(Method.java:511)
08-23 08:17:32.260: E/AndroidRuntime(641): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
08-23 08:17:32.260: E/AndroidRuntime(641): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
08-23 08:17:32.260: E/AndroidRuntime(641): at dalvik.system.NativeStart.main(Native Method)
08-23 08:17:32.260: E/AndroidRuntime(641): Caused by: android.os.NetworkOnMainThreadException
08-23 08:17:32.260: E/AndroidRuntime(641): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1117)
08-23 08:17:32.260: E/AndroidRuntime(641): at java.net.InetAddress.lookupHostByName(InetAddress.java:385)
08-23 08:17:32.260: E/AndroidRuntime(641): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236)
08-23 08:17:32.260: E/AndroidRuntime(641): at java.net.InetAddress.getAllByName(InetAddress.java:214)
08-23 08:17:32.260: E/AndroidRuntime(641): at libcore.net.http.HttpConnection.<init>(HttpConnection.java:70)
08-23 08:17:32.260: E/AndroidRuntime(641): at libcore.net.http.HttpConnection.<init>(HttpConnection.java:50)
08-23 08:17:32.260: E/AndroidRuntime(641): at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:341)
08-23 08:17:32.260: E/AndroidRuntime(641): at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:87)
08-23 08:17:32.260: E/AndroidRuntime(641): at libcore.net.http.HttpConnection.connect(HttpConnection.java:128)
08-23 08:17:32.260: E/AndroidRuntime(641): at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:315)
08-23 08:17:32.260: E/AndroidRuntime(641): at libcore.net.http.HttpEngine.connect(HttpEngine.java:310)
08-23 08:17:32.260: E/AndroidRuntime(641): at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:289)
08-23 08:17:32.260: E/AndroidRuntime(641): at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:239)
08-23 08:17:32.260: E/AndroidRuntime(641): at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:273)
08-23 08:17:32.260: E/AndroidRuntime(641): at libcore.net.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:168)
08-23 08:17:32.260: E/AndroidRuntime(641): at java.net.URL.openStream(URL.java:462)
08-23 08:17:32.260: E/AndroidRuntime(641): at de.damps.fantasy.Json.readUrl(Json.java:39)
08-23 08:17:32.260: E/AndroidRuntime(641): at de.damps.fantasy.Json.<init>(Json.java:20)
08-23 08:17:32.260: E/AndroidRuntime(641): at de.damps.fantasy.scoresActivity.parse(scoresActivity.java:110)
08-23 08:17:32.260: E/AndroidRuntime(641): at de.damps.fantasy.scoresActivity.onCreate(scoresActivity.java:34)
08-23 08:17:32.260: E/AndroidRuntime(641): at android.app.Activity.performCreate(Activity.java:5008)
08-23 08:17:32.260: E/AndroidRuntime(641): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
08-23 08:17:32.260: E/AndroidRuntime(641): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
08-23 08:17:32.260: E/AndroidRuntime(641): ... 11 more
08-23 08:17:32.399: D/dalvikvm(641): GC_CONCURRENT freed 227K, 3% free 11198K/11463K, paused 77ms+106ms, total 270ms