- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我正在为 Android 应用创建自定义日历。它现在的工作方式是从在线 MySQL 数据库中提取事件,将它们传输到 JSONArray 中,然后从那里将它们输入到日历中。它在模拟器上运行良好(如果有点慢),但今天我连接了我的 S3,它给了我以前没有收到的错误。我在日志中遇到的错误是:
09-14 22:52:12.611: E/dalvikvm(4605): threadid=2: stuck on threadid=1, giving up
09-14 22:52:12.611: E/dalvikvm(4605): 致命的自旋挂起,倾倒线程
这是它一直挂断的 ASyncTask:
package com.legends.app;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.json.JSONArray;
import android.os.AsyncTask;
import android.util.Log;
public class Events extends AsyncTask<Void, Void, String> {
JSONArray jArray;
public String result = null;
InputStream is = null;
StringBuilder sb=null;
HttpEntity entity;
protected String doInBackground(Void... arg0) {
//http post - calls from the php file that opens the DB
try{
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://legendsofnotredame.org/club/mobile/android/cal.php");
HttpResponse response = httpclient.execute(httppost);
entity = response.getEntity();
}catch(Exception e){
Log.e("log_tag", "Error in http connection"+e.toString());
}
//convert response to string
try{
is = entity.getContent();
BufferedReader reader = new BufferedReader(new InputStreamReader(is,"iso-8859-1"),8);
sb = new StringBuilder();
sb.append(reader.readLine() + "\n");
String line="0";
while ((line = reader.readLine()) != null) {
sb.append(line + "\n");
}
is.close();
result=sb.toString();
}catch(Exception e){
Log.e("log_tag", "Error converting result "+e.toString());
}
Log.e("test","Converted results to string");
return result;
}
protected void onPostExecute(String result) {
}
}
添加大量日志后,我确定它卡在“sb.append(reader.readLine() + "\n");”上,但我不确定如何让它不执行那。有什么建议吗?
编辑:这是运行它的(几乎)完整的 logcat,从它卡在 readLine 上的地方开始。由于这篇文章太长,我不得不在一开始删除一些非警告/非错误行,抱歉!
09-15 14:02:13.251: W/dalvikvm(21710): threadid=2: spin on suspend #1 threadid=1 (pcf=0)
09-15 14:02:14.001: W/dalvikvm(21710): threadid=2: spin on suspend #2 threadid=1 (pcf=0)
09-15 14:02:14.752: W/dalvikvm(21710): threadid=2: spin on suspend #3 threadid=1 (pcf=0)
09-15 14:02:15.503: W/dalvikvm(21710): threadid=2: spin on suspend #4 threadid=1 (pcf=0)
09-15 14:02:16.254: W/dalvikvm(21710): threadid=2: spin on suspend #5 threadid=1 (pcf=0)
09-15 14:02:16.254: I/dalvikvm(21710): "GC" daemon prio=5 tid=2 RUNNABLE
09-15 14:02:16.254: I/dalvikvm(21710): | group="system" sCount=0 dsCount=0 obj=0x419b4d68 self=0x124d8e8
09-15 14:02:16.254: I/dalvikvm(21710): | sysTid=21712 nice=0 sched=0/0 cgrp=default handle=19191584
09-15 14:02:16.254: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=0 stm=0 core=0
09-15 14:02:16.254: I/dalvikvm(21710): at dalvik.system.NativeStart.run(Native Method)
09-15 14:02:16.254: I/dalvikvm(21710): "main" prio=5 tid=1 RUNNABLE JIT
09-15 14:02:16.254: I/dalvikvm(21710): | group="main" sCount=1 dsCount=0 obj=0x40c3fcd0 self=0x10c2c30
09-15 14:02:16.254: I/dalvikvm(21710): | sysTid=21710 nice=0 sched=0/0 cgrp=default handle=1074750856
09-15 14:02:16.254: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=640 stm=5 core=0
09-15 14:02:16.254: I/dalvikvm(21710): at com.legends.app.CalendarActivity.onCreate(CalendarActivity.java:~122)
09-15 14:02:16.254: I/dalvikvm(21710): at android.app.Activity.performCreate(Activity.java:4470)
09-15 14:02:16.254: I/dalvikvm(21710): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053)
09-15 14:02:16.254: I/dalvikvm(21710): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934)
09-15 14:02:16.254: I/dalvikvm(21710): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
09-15 14:02:16.254: I/dalvikvm(21710): at android.app.ActivityThread.access$600(ActivityThread.java:128)
09-15 14:02:16.254: I/dalvikvm(21710): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
09-15 14:02:16.254: I/dalvikvm(21710): at android.os.Handler.dispatchMessage(Handler.java:99)
09-15 14:02:16.254: I/dalvikvm(21710): at android.os.Looper.loop(Looper.java:137)
09-15 14:02:16.254: I/dalvikvm(21710): at android.app.ActivityThread.main(ActivityThread.java:4514)
09-15 14:02:16.254: I/dalvikvm(21710): at java.lang.reflect.Method.invokeNative(Native Method)
09-15 14:02:16.254: I/dalvikvm(21710): at java.lang.reflect.Method.invoke(Method.java:511)
09-15 14:02:16.254: I/dalvikvm(21710): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980)
09-15 14:02:16.254: I/dalvikvm(21710): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
09-15 14:02:16.254: I/dalvikvm(21710): at dalvik.system.NativeStart.main(Native Method)
09-15 14:02:17.005: W/dalvikvm(21710): threadid=2: spin on suspend #6 threadid=1 (pcf=0)
09-15 14:02:17.005: I/dalvikvm(21710): "GC" daemon prio=5 tid=2 RUNNABLE
09-15 14:02:17.005: I/dalvikvm(21710): | group="system" sCount=0 dsCount=0 obj=0x419b4d68 self=0x124d8e8
09-15 14:02:17.005: I/dalvikvm(21710): | sysTid=21712 nice=0 sched=0/0 cgrp=default handle=19191584
09-15 14:02:17.005: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=0 stm=0 core=0
09-15 14:02:17.005: I/dalvikvm(21710): at dalvik.system.NativeStart.run(Native Method)
09-15 14:02:17.005: I/dalvikvm(21710): "main" prio=5 tid=1 RUNNABLE JIT
09-15 14:02:17.005: I/dalvikvm(21710): | group="main" sCount=1 dsCount=0 obj=0x40c3fcd0 self=0x10c2c30
09-15 14:02:17.005: I/dalvikvm(21710): | sysTid=21710 nice=0 sched=0/0 cgrp=default handle=1074750856
09-15 14:02:17.005: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=712 stm=5 core=0
09-15 14:02:17.015: I/dalvikvm(21710): at com.legends.app.CalendarActivity.onCreate(CalendarActivity.java:~122)
09-15 14:02:17.015: I/dalvikvm(21710): at android.app.Activity.performCreate(Activity.java:4470)
09-15 14:02:17.015: I/dalvikvm(21710): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053)
09-15 14:02:17.015: I/dalvikvm(21710): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934)
09-15 14:02:17.015: I/dalvikvm(21710): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
09-15 14:02:17.015: I/dalvikvm(21710): at android.app.ActivityThread.access$600(ActivityThread.java:128)
09-15 14:02:17.015: I/dalvikvm(21710): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
09-15 14:02:17.015: I/dalvikvm(21710): at android.os.Handler.dispatchMessage(Handler.java:99)
09-15 14:02:17.015: I/dalvikvm(21710): at android.os.Looper.loop(Looper.java:137)
09-15 14:02:17.015: I/dalvikvm(21710): at android.app.ActivityThread.main(ActivityThread.java:4514)
09-15 14:02:17.015: I/dalvikvm(21710): at java.lang.reflect.Method.invokeNative(Native Method)
09-15 14:02:17.015: I/dalvikvm(21710): at java.lang.reflect.Method.invoke(Method.java:511)
09-15 14:02:17.015: I/dalvikvm(21710): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980)
09-15 14:02:17.015: I/dalvikvm(21710): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
09-15 14:02:17.015: I/dalvikvm(21710): at dalvik.system.NativeStart.main(Native Method)
09-15 14:02:17.765: W/dalvikvm(21710): threadid=2: spin on suspend #7 threadid=1 (pcf=0)
09-15 14:02:17.765: I/dalvikvm(21710): "GC" daemon prio=5 tid=2 RUNNABLE
09-15 14:02:17.765: I/dalvikvm(21710): | group="system" sCount=0 dsCount=0 obj=0x419b4d68 self=0x124d8e8
09-15 14:02:17.765: I/dalvikvm(21710): | sysTid=21712 nice=0 sched=0/0 cgrp=default handle=19191584
09-15 14:02:17.765: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=0 stm=0 core=0
09-15 14:02:17.765: I/dalvikvm(21710): at dalvik.system.NativeStart.run(Native Method)
09-15 14:02:17.765: I/dalvikvm(21710): "main" prio=5 tid=1 RUNNABLE JIT
09-15 14:02:17.765: I/dalvikvm(21710): | group="main" sCount=1 dsCount=0 obj=0x40c3fcd0 self=0x10c2c30
09-15 14:02:17.765: I/dalvikvm(21710): | sysTid=21710 nice=0 sched=0/0 cgrp=default handle=1074750856
09-15 14:02:17.765: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=762 stm=5 core=0
09-15 14:02:17.765: I/dalvikvm(21710): at com.legends.app.CalendarActivity.onCreate(CalendarActivity.java:~122)
09-15 14:02:17.765: I/dalvikvm(21710): at android.app.Activity.performCreate(Activity.java:4470)
09-15 14:02:17.765: I/dalvikvm(21710): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053)
09-15 14:02:17.765: I/dalvikvm(21710): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934)
09-15 14:02:17.765: I/dalvikvm(21710): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
09-15 14:02:17.765: I/dalvikvm(21710): at android.app.ActivityThread.access$600(ActivityThread.java:128)
09-15 14:02:17.765: I/dalvikvm(21710): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
09-15 14:02:17.765: I/dalvikvm(21710): at android.os.Handler.dispatchMessage(Handler.java:99)
09-15 14:02:17.765: I/dalvikvm(21710): at android.os.Looper.loop(Looper.java:137)
09-15 14:02:17.765: I/dalvikvm(21710): at android.app.ActivityThread.main(ActivityThread.java:4514)
09-15 14:02:17.765: I/dalvikvm(21710): at java.lang.reflect.Method.invokeNative(Native Method)
09-15 14:02:17.765: I/dalvikvm(21710): at java.lang.reflect.Method.invoke(Method.java:511)
09-15 14:02:17.765: I/dalvikvm(21710): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980)
09-15 14:02:17.765: I/dalvikvm(21710): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
09-15 14:02:17.765: I/dalvikvm(21710): at dalvik.system.NativeStart.main(Native Method)
09-15 14:02:18.516: W/dalvikvm(21710): threadid=2: spin on suspend #8 threadid=1 (pcf=0)
09-15 14:02:18.516: I/dalvikvm(21710): "GC" daemon prio=5 tid=2 RUNNABLE
09-15 14:02:18.516: I/dalvikvm(21710): | group="system" sCount=0 dsCount=0 obj=0x419b4d68 self=0x124d8e8
09-15 14:02:18.516: I/dalvikvm(21710): | sysTid=21712 nice=0 sched=0/0 cgrp=default handle=19191584
09-15 14:02:18.516: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=0 stm=0 core=0
09-15 14:02:18.516: I/dalvikvm(21710): at dalvik.system.NativeStart.run(Native Method)
09-15 14:02:18.516: I/dalvikvm(21710): "main" prio=5 tid=1 RUNNABLE JIT
09-15 14:02:18.516: I/dalvikvm(21710): | group="main" sCount=1 dsCount=0 obj=0x40c3fcd0 self=0x10c2c30
09-15 14:02:18.516: I/dalvikvm(21710): | sysTid=21710 nice=0 sched=0/0 cgrp=default handle=1074750856
09-15 14:02:18.516: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=834 stm=5 core=0
09-15 14:02:18.516: I/dalvikvm(21710): at com.legends.app.CalendarActivity.onCreate(CalendarActivity.java:~122)
09-15 14:02:18.516: I/dalvikvm(21710): at android.app.Activity.performCreate(Activity.java:4470)
09-15 14:02:18.516: I/dalvikvm(21710): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053)
09-15 14:02:18.516: I/dalvikvm(21710): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934)
09-15 14:02:18.516: I/dalvikvm(21710): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
09-15 14:02:18.516: I/dalvikvm(21710): at android.app.ActivityThread.access$600(ActivityThread.java:128)
09-15 14:02:18.516: I/dalvikvm(21710): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
09-15 14:02:18.516: I/dalvikvm(21710): at android.os.Handler.dispatchMessage(Handler.java:99)
09-15 14:02:18.516: I/dalvikvm(21710): at android.os.Looper.loop(Looper.java:137)
09-15 14:02:18.516: I/dalvikvm(21710): at android.app.ActivityThread.main(ActivityThread.java:4514)
09-15 14:02:18.516: I/dalvikvm(21710): at java.lang.reflect.Method.invokeNative(Native Method)
09-15 14:02:18.516: I/dalvikvm(21710): at java.lang.reflect.Method.invoke(Method.java:511)
09-15 14:02:18.516: I/dalvikvm(21710): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980)
09-15 14:02:18.516: I/dalvikvm(21710): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
09-15 14:02:18.516: I/dalvikvm(21710): at dalvik.system.NativeStart.main(Native Method)
09-15 14:02:19.267: W/dalvikvm(21710): threadid=2: spin on suspend #9 threadid=1 (pcf=0)
09-15 14:02:19.267: I/dalvikvm(21710): "GC" daemon prio=5 tid=2 RUNNABLE
09-15 14:02:19.267: I/dalvikvm(21710): | group="system" sCount=0 dsCount=0 obj=0x419b4d68 self=0x124d8e8
09-15 14:02:19.267: I/dalvikvm(21710): | sysTid=21712 nice=0 sched=0/0 cgrp=default handle=19191584
09-15 14:02:19.267: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=0 stm=0 core=0
09-15 14:02:19.267: I/dalvikvm(21710): at dalvik.system.NativeStart.run(Native Method)
09-15 14:02:19.267: I/dalvikvm(21710): "main" prio=5 tid=1 RUNNABLE JIT
09-15 14:02:19.267: I/dalvikvm(21710): | group="main" sCount=1 dsCount=0 obj=0x40c3fcd0 self=0x10c2c30
09-15 14:02:19.267: I/dalvikvm(21710): | sysTid=21710 nice=0 sched=0/0 cgrp=default handle=1074750856
09-15 14:02:19.267: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=906 stm=5 core=0
09-15 14:02:19.267: I/dalvikvm(21710): at com.legends.app.CalendarActivity.onCreate(CalendarActivity.java:~122)
09-15 14:02:19.267: I/dalvikvm(21710): at android.app.Activity.performCreate(Activity.java:4470)
09-15 14:02:19.267: I/dalvikvm(21710): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053)
09-15 14:02:19.267: I/dalvikvm(21710): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934)
09-15 14:02:19.267: I/dalvikvm(21710): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
09-15 14:02:19.267: I/dalvikvm(21710): at android.app.ActivityThread.access$600(ActivityThread.java:128)
09-15 14:02:19.267: I/dalvikvm(21710): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
09-15 14:02:19.267: I/dalvikvm(21710): at android.os.Handler.dispatchMessage(Handler.java:99)
09-15 14:02:19.267: I/dalvikvm(21710): at android.os.Looper.loop(Looper.java:137)
09-15 14:02:19.267: I/dalvikvm(21710): at android.app.ActivityThread.main(ActivityThread.java:4514)
09-15 14:02:19.267: I/dalvikvm(21710): at java.lang.reflect.Method.invokeNative(Native Method)
09-15 14:02:19.267: I/dalvikvm(21710): at java.lang.reflect.Method.invoke(Method.java:511)
09-15 14:02:19.267: I/dalvikvm(21710): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980)
09-15 14:02:19.267: I/dalvikvm(21710): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
09-15 14:02:19.267: I/dalvikvm(21710): at dalvik.system.NativeStart.main(Native Method)
09-15 14:02:20.018: W/dalvikvm(21710): threadid=2: spin on suspend #10 threadid=1 (pcf=0)
09-15 14:02:20.018: I/dalvikvm(21710): "GC" daemon prio=5 tid=2 RUNNABLE
09-15 14:02:20.018: I/dalvikvm(21710): | group="system" sCount=0 dsCount=0 obj=0x419b4d68 self=0x124d8e8
09-15 14:02:20.018: I/dalvikvm(21710): | sysTid=21712 nice=0 sched=0/0 cgrp=default handle=19191584
09-15 14:02:20.018: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=0 stm=0 core=0
09-15 14:02:20.018: I/dalvikvm(21710): at dalvik.system.NativeStart.run(Native Method)
09-15 14:02:20.018: I/dalvikvm(21710): "main" prio=5 tid=1 RUNNABLE JIT
09-15 14:02:20.018: I/dalvikvm(21710): | group="main" sCount=1 dsCount=0 obj=0x40c3fcd0 self=0x10c2c30
09-15 14:02:20.018: I/dalvikvm(21710): | sysTid=21710 nice=0 sched=0/0 cgrp=default handle=1074750856
09-15 14:02:20.018: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=979 stm=5 core=0
09-15 14:02:20.018: I/dalvikvm(21710): at com.legends.app.CalendarActivity.onCreate(CalendarActivity.java:~122)
09-15 14:02:20.018: I/dalvikvm(21710): at android.app.Activity.performCreate(Activity.java:4470)
09-15 14:02:20.018: I/dalvikvm(21710): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053)
09-15 14:02:20.018: I/dalvikvm(21710): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934)
09-15 14:02:20.018: I/dalvikvm(21710): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
09-15 14:02:20.018: I/dalvikvm(21710): at android.app.ActivityThread.access$600(ActivityThread.java:128)
09-15 14:02:20.018: I/dalvikvm(21710): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
09-15 14:02:20.018: I/dalvikvm(21710): at android.os.Handler.dispatchMessage(Handler.java:99)
09-15 14:02:20.018: I/dalvikvm(21710): at android.os.Looper.loop(Looper.java:137)
09-15 14:02:20.018: I/dalvikvm(21710): at android.app.ActivityThread.main(ActivityThread.java:4514)
09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.reflect.Method.invokeNative(Native Method)
09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.reflect.Method.invoke(Method.java:511)
09-15 14:02:20.018: I/dalvikvm(21710): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980)
09-15 14:02:20.018: I/dalvikvm(21710): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
09-15 14:02:20.018: I/dalvikvm(21710): at dalvik.system.NativeStart.main(Native Method)
09-15 14:02:20.018: E/dalvikvm(21710): Fatal spin-on-suspend, dumping threads
09-15 14:02:20.018: I/dalvikvm(21710): DALVIK THREADS:
09-15 14:02:20.018: I/dalvikvm(21710): (mutexes: tll=2 tsl=1 tscl=0 ghl=1)
09-15 14:02:20.018: I/dalvikvm(21710): "main" prio=5 tid=1 RUNNABLE JIT
09-15 14:02:20.018: I/dalvikvm(21710): | group="main" sCount=1 dsCount=0 obj=0x40c3fcd0 self=0x10c2c30
09-15 14:02:20.018: I/dalvikvm(21710): | sysTid=21710 nice=0 sched=0/0 cgrp=default handle=1074750856
09-15 14:02:20.018: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=979 stm=5 core=0
09-15 14:02:20.018: I/dalvikvm(21710): at com.legends.app.CalendarActivity.onCreate(CalendarActivity.java:~122)
09-15 14:02:20.018: I/dalvikvm(21710): at android.app.Activity.performCreate(Activity.java:4470)
09-15 14:02:20.018: I/dalvikvm(21710): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053)
09-15 14:02:20.018: I/dalvikvm(21710): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934)
09-15 14:02:20.018: I/dalvikvm(21710): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
09-15 14:02:20.018: I/dalvikvm(21710): at android.app.ActivityThread.access$600(ActivityThread.java:128)
09-15 14:02:20.018: I/dalvikvm(21710): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
09-15 14:02:20.018: I/dalvikvm(21710): at android.os.Handler.dispatchMessage(Handler.java:99)
09-15 14:02:20.018: I/dalvikvm(21710): at android.os.Looper.loop(Looper.java:137)
09-15 14:02:20.018: I/dalvikvm(21710): at android.app.ActivityThread.main(ActivityThread.java:4514)
09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.reflect.Method.invokeNative(Native Method)
09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.reflect.Method.invoke(Method.java:511)
09-15 14:02:20.018: I/dalvikvm(21710): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980)
09-15 14:02:20.018: I/dalvikvm(21710): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
09-15 14:02:20.018: I/dalvikvm(21710): at dalvik.system.NativeStart.main(Native Method)
09-15 14:02:20.018: I/dalvikvm(21710): "AsyncTask #1" prio=5 tid=11 SUSPENDED
09-15 14:02:20.018: I/dalvikvm(21710): | group="main" sCount=1 dsCount=0 obj=0x41a23660 self=0x12d4758
09-15 14:02:20.018: I/dalvikvm(21710): | sysTid=21739 nice=10 sched=0/0 cgrp=bg_non_interactive handle=19348592
09-15 14:02:20.018: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=18 stm=2 core=1
09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.AbstractStringBuilder.append0(AbstractStringBuilder.java:~128)
09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.StringBuilder.append(StringBuilder.java:271)
09-15 14:02:20.018: I/dalvikvm(21710): at java.io.BufferedReader.readLine(BufferedReader.java:417)
09-15 14:02:20.018: I/dalvikvm(21710): at com.legends.app.Events.doInBackground(Events.java:56)
09-15 14:02:20.018: I/dalvikvm(21710): at com.legends.app.Events.doInBackground(Events.java:1)
09-15 14:02:20.018: I/dalvikvm(21710): at android.os.AsyncTask$2.call(AsyncTask.java:264)
09-15 14:02:20.018: I/dalvikvm(21710): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
09-15 14:02:20.018: I/dalvikvm(21710): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
09-15 14:02:20.018: I/dalvikvm(21710): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208)
09-15 14:02:20.018: I/dalvikvm(21710): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
09-15 14:02:20.018: I/dalvikvm(21710): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.Thread.run(Thread.java:856)
09-15 14:02:20.018: I/dalvikvm(21710): "Binder Thread #2" prio=5 tid=10 SUSPENDED
09-15 14:02:20.018: I/dalvikvm(21710): | group="main" sCount=1 dsCount=0 obj=0x419b8f08 self=0x12dec18
09-15 14:02:20.018: I/dalvikvm(21710): | sysTid=21722 nice=0 sched=0/0 cgrp=default handle=18856864
09-15 14:02:20.018: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=0 stm=0 core=0
09-15 14:02:20.018: I/dalvikvm(21710): at dalvik.system.NativeStart.run(Native Method)
09-15 14:02:20.018: I/dalvikvm(21710): "Binder Thread #1" prio=5 tid=9 SUSPENDED
09-15 14:02:20.018: I/dalvikvm(21710): | group="main" sCount=1 dsCount=0 obj=0x419b8540 self=0x12dcf78
09-15 14:02:20.018: I/dalvikvm(21710): | sysTid=21721 nice=0 sched=0/0 cgrp=default handle=19135504
09-15 14:02:20.018: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=0 stm=0 core=0
09-15 14:02:20.018: I/dalvikvm(21710): at dalvik.system.NativeStart.run(Native Method)
09-15 14:02:20.018: I/dalvikvm(21710): "FinalizerWatchdogDaemon" daemon prio=5 tid=8 WAIT
09-15 14:02:20.018: I/dalvikvm(21710): | group="main" sCount=1 dsCount=0 obj=0x419b53d8 self=0x12e6520
09-15 14:02:20.018: I/dalvikvm(21710): | sysTid=21720 nice=0 sched=0/0 cgrp=default handle=18832048
09-15 14:02:20.018: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=0 stm=0 core=1
09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.Object.wait(Native Method)
09-15 14:02:20.018: I/dalvikvm(21710): - waiting on <0x40c474f0> (a java.lang.Daemons$FinalizerWatchdogDaemon)
09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.Object.wait(Object.java:364)
09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.Daemons$FinalizerWatchdogDaemon.run(Daemons.java:213)
09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.Thread.run(Thread.java:856)
09-15 14:02:20.018: I/dalvikvm(21710): "FinalizerDaemon" daemon prio=5 tid=7 WAIT
09-15 14:02:20.018: I/dalvikvm(21710): | group="main" sCount=1 dsCount=0 obj=0x419b5280 self=0x12d3a48
09-15 14:02:20.018: I/dalvikvm(21710): | sysTid=21719 nice=0 sched=0/0 cgrp=default handle=18676648
09-15 14:02:20.018: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=0 stm=0 core=0
09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.Object.wait(Native Method)
09-15 14:02:20.018: I/dalvikvm(21710): - waiting on <0x40c355d0> (a java.lang.ref.ReferenceQueue)
09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.Object.wait(Object.java:401)
09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:102)
09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:73)
09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:168)
09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.Thread.run(Thread.java:856)
09-15 14:02:20.018: I/dalvikvm(21710): "ReferenceQueueDaemon" daemon prio=5 tid=6 WAIT
09-15 14:02:20.018: I/dalvikvm(21710): | group="main" sCount=1 dsCount=0 obj=0x419b5118 self=0x12e7bd8
09-15 14:02:20.018: I/dalvikvm(21710): | sysTid=21718 nice=0 sched=0/0 cgrp=default handle=18676448
09-15 14:02:20.018: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=0 stm=0 core=0
09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.Object.wait(Native Method)
09-15 14:02:20.018: I/dalvikvm(21710): - waiting on <0x40c354f8>
09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.Object.wait(Object.java:364)
09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.Daemons$ReferenceQueueDaemon.run(Daemons.java:128)
09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.Thread.run(Thread.java:856)
09-15 14:02:20.018: I/dalvikvm(21710): "Compiler" daemon prio=5 tid=5 VMWAIT
09-15 14:02:20.018: I/dalvikvm(21710): | group="system" sCount=1 dsCount=0 obj=0x419b5028 self=0x12b2640
09-15 14:02:20.018: I/dalvikvm(21710): | sysTid=21717 nice=0 sched=0/0 cgrp=default handle=18856760
09-15 14:02:20.018: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=2 stm=2 core=1
09-15 14:02:20.018: I/dalvikvm(21710): at dalvik.system.NativeStart.run(Native Method)
09-15 14:02:20.018: I/dalvikvm(21710): "JDWP" daemon prio=5 tid=4 VMWAIT
09-15 14:02:20.018: I/dalvikvm(21710): | group="system" sCount=1 dsCount=0 obj=0x419b4f40 self=0x1269cc0
09-15 14:02:20.018: I/dalvikvm(21710): | sysTid=21715 nice=0 sched=0/0 cgrp=default handle=19135712
09-15 14:02:20.018: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=0 stm=0 core=1
09-15 14:02:20.018: I/dalvikvm(21710): at dalvik.system.NativeStart.run(Native Method)
09-15 14:02:20.018: I/dalvikvm(21710): "Signal Catcher" daemon prio=5 tid=3 VMWAIT
09-15 14:02:20.018: I/dalvikvm(21710): | group="system" sCount=1 dsCount=0 obj=0x419b4e48 self=0x12abed8
09-15 14:02:20.018: I/dalvikvm(21710): | sysTid=21713 nice=0 sched=0/0 cgrp=default handle=18712776
09-15 14:02:20.018: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=0 stm=0 core=0
09-15 14:02:20.018: I/dalvikvm(21710): at dalvik.system.NativeStart.run(Native Method)
09-15 14:02:20.018: I/dalvikvm(21710): "GC" daemon prio=5 tid=2 RUNNABLE
09-15 14:02:20.018: I/dalvikvm(21710): | group="system" sCount=0 dsCount=0 obj=0x419b4d68 self=0x124d8e8
09-15 14:02:20.018: I/dalvikvm(21710): | sysTid=21712 nice=0 sched=0/0 cgrp=default handle=19191584
09-15 14:02:20.018: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=0 stm=0 core=0
09-15 14:02:20.018: I/dalvikvm(21710): at dalvik.system.NativeStart.run(Native Method)
09-15 14:02:20.018: E/dalvikvm(21710): threadid=2: stuck on threadid=1, giving up
09-15 14:02:20.018: D/dalvikvm(21710): threadid=2: sending two SIGSTKFLTs to threadid=1 (tid=21710) to cause debuggerd dump
09-15 14:02:20.018: D/dalvikvm(21710): NOTE: pthread_kill #1 failed: Operation not permitted
09-15 14:02:22.010: D/dalvikvm(21710): NOTE: pthread_kill #2 failed: Operation not permitted
09-15 14:02:22.010: D/dalvikvm(21710): Sent, pausing to let debuggerd run
09-15 14:02:30.018: D/dalvikvm(21710): Continuing
09-15 14:02:30.018: E/dalvikvm(21710): VM aborting
这是我在主 Activity 中调用它的地方。这也是两个单独的文件,我不知道这是否相关,但我不知道可能相关。
Events db = new Events();
db.execute();
while (db.result == null){
continue;}
result = db.result;
最佳答案
我又玩了一天之后弄明白了。由于非 AsyncTask 中的这些行而超时:
while (db.result == null) {
continue;
}
它认为这是“你永远陷入了 while 循环,因此程序一定已经崩溃了”,而实际上它只是花时间来阅读事件。但是,如果没有它,它会在没有完全加载事件的情况下继续前进,并在尝试使用该数组时创建 NullPointerException。我所做的是这样做:
while (db.result == null){
try {
Thread.sleep(100);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
continue;
}
sleep 似乎将我还在那里的应用程序发回,只是等待数据以便我可以继续。或者它会减慢我通过 while 循环的次数。不确定它执行哪一个,但无论哪种方式都可以解决问题。
关于java - 致命自旋挂起/卡在 ThreadID 上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12434182/
在 Android 的 API > 19 中是否有任何方法可以获取可移动 SD 卡的路径? 与外部 SD 卡一样,我们有 Environment.getExternalStorageDirectory
一些 Android 设备有 microSD(或其他存储卡)插槽,通常安装为 /storage/sdcard1 据我所知,自 Android 4.4 起 Google 限制了对此内存的访问,并在 An
我使用 Java Card 2.1.2 SDK 和 GPShell 作为与设备通信的方式在 Java Card 上构建一个项目。我从 GpShell 测试了 helloworld 示例,并成功发送了
我开发了一个应用程序,它有一个来电接收器,它适用于所有手机。一位用户有一部双 SIM 卡安卓手机。该应用程序适用于第一张 SIM 卡。但是当有人调用他的第二张 SIM 卡时,我们的应用程序不会被调用。
我有一个带预览的文件输入。 这是笔 Codepen 我想强制高度,我无法理解我该怎么做。我想将此组件的高度固定为 300px(示例),我还需要保持加载图像的正确纵横比,用灰色背景填充空白。现在我保持宽
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 想改进这个问题?将问题更新为 on-topic对于堆栈溢出。 6年前关闭。 Improve this qu
我正在使用此代码访问 SD card : import os from os.path import join from jnius import autoclass #from android.pe
我正在为数据记录设备编写固件。它以 20 Hz 的频率从传感器读取数据并将数据写入 SD 卡。但是,向SD卡写入数据的时间并不一致(大约200-300 ms)。因此,一种解决方案是以一致的速率将数据写
我正在使用以下代码将视频放到网站上,但是在垂直方向上,手机屏幕上只能看到视频的左半部分 我不是网络开发人员。有人可以告诉我确切的内容吗,如何使其正确放置在手机屏幕上? 是在youtube iframe
我正在使用 Vuetify 1.5 和 Vuetify 网格系统来设置我的布局。现在我有一个组件 HelloWorld我将其导入到我的 Parent 中成分。我已经在我的 HelloWorld 中设置
我使用 python 制作了一个简单的二十一点游戏。我制作了游戏的其余部分,但我正在努力放入 ASCII 卡,所以这只是代码的一小部分。我尝试将 * len(phand) 放在附加行的末尾。虽然这确实
我正在使用玩家卡设置 Twitter 卡。它可以在预览工具中运行,但文档说它需要在“twitter.com 现代桌面浏览器? native iOs 和 Android Twitter 应用程序?mob
任何旧的 GSM 兼容 SIM 卡(3G USIM 的奖励)。 我想我需要一些硬件?谁能为业余爱好者推荐一些便宜的东西,以及一些更专业的东西? 我认为会有一个带有硬件的 API 的完整文档,所以也许这
我使用 python 制作了一个简单的二十一点游戏。我制作了游戏的其余部分,但我正在努力放入 ASCII 卡,所以这只是代码的一小部分。我尝试将 * len(phand) 放在附加行的末尾。虽然这确实
我记得前一段时间读到有 cpu 卡供系统添加额外的处理能力来进行大规模并行化。任何人都有这方面的经验和任何资源来研究项目的硬件和软件方面吗?这项技术是否不如传统集群?它更注重功率吗? 最佳答案 有两个
我检查外部存储是否已安装并且可用于读/写,然后从中读取。我使用的是确切的官方 Android 示例代码 ( from here )。 它说外部存储未安装。 getExternalFilesDir(nu
在 Android 2.1 及更低版本中,Android 应用程序可以请求下载到 SD 卡上吗?另外我想知道应用程序是否可以请求一些包含视频的文件夹下载到 SD 卡上?以及如何做到这一点? 提前致谢。
我们编写了一个 Windows 设备驱动程序来访问我们的自定义 PCI 卡。驱动程序使用 CreateFile 获取卡的句柄。 我们最近在一次安装中遇到了问题,卡似乎停止工作了。我们尝试更换卡(更换似
有些新设备(例如 Samsung Galaxy)带有两个 SD 卡。我想知道是否有任何方法可以确定设备是否有两张 SD 卡或一张 SD 卡。谢谢 最佳答案 我认为唯一的方法是使用 检查可用根的列表 F
我正在尝试将文件读/写到 SD 卡。我已经尝试在我的真实手机和 Eclipse 中的模拟器上执行此操作。在这两种设备上,对/mnt/sdcard/或/sdcard 的权限仅为“d--------”,我
我是一名优秀的程序员,十分优秀!