为什么我的Xamarin android应用程序始终没有响应?

时间:2018-08-10 23:18:21

标签: android xamarin google-play android-anr-dialog

我已将一个应用程序上载到Google应用程序,但是尽管我在模拟器上没有遇到任何问题,它仍然没有响应。

我收到下面的ANR报告,但没有告诉我们要解决的问题在哪里?我没有任何东西可以长时间在应用程序中运行。

我在页面中唯一使用的只是Syncfusion Rotator和用于导航到其他页面的按钮。

请帮助...

Broadcast of Intent { act=android.intent.action.SCREEN_ON flg=0x50000010 VirtualScreenParam=Params{mDisplayId=-1, null, mFlags=0x00000000)} }


"main" prio=5 tid=1 Native
  | group="main" sCount=1 dsCount=0 obj=0x75696598 self=0xab047f08
  | sysTid=20139 nice=0 cgrp=default sched=0/0 handle=0xf76a9b50
  | state=R schedstat=( 119604524599 1335738839 21209 ) utm=11496 stm=464 core=1 HZ=100
  | stack=0xff460000-0xff462000 stackSize=8MB
  | held mutexes=
  #00  pc 0000000000268df0  /data/app/com.jafaria.app-2/lib/arm/libmonosgen-2.0.so (???)
  at mono.java.lang.Runnable.n_run (Native method)
  at mono.java.lang.Runnable.run (Runnable.java:30)
  at android.os.Handler.handleCallback (Handler.java:739)
  at android.os.Handler.dispatchMessage (Handler.java:95)
  at android.os.Looper.loop (Looper.java:148)
  at android.app.ActivityThread.main (ActivityThread.java:7326)
  at java.lang.reflect.Method.invoke! (Native method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1230)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1120)


"ReferenceQueueDaemon" daemon prio=5 tid=3 Waiting
  | group="system" sCount=1 dsCount=0 obj=0x12c55640 self=0xab2edde0
  | sysTid=20145 nice=0 cgrp=default sched=0/0 handle=0xf45b7930
  | state=S schedstat=( 193499302 22057244 1774 ) utm=5 stm=14 core=6 HZ=100
  | stack=0xf44b5000-0xf44b7000 stackSize=1038KB
  | held mutexes=
  at java.lang.Object.wait! (Native method)
- waiting on <0x09f0b00c> (a java.lang.Class<java.lang.ref.ReferenceQueue>)
  at java.lang.Daemons$ReferenceQueueDaemon.run (Daemons.java:162)
- locked <0x09f0b00c> (a java.lang.Class<java.lang.ref.ReferenceQueue>)
  at java.lang.Thread.run (Thread.java:818)


"FinalizerDaemon" daemon prio=5 tid=4 Waiting
  | group="system" sCount=1 dsCount=0 obj=0x12c556a0 self=0xab1aa4c8
  | sysTid=20146 nice=0 cgrp=default sched=0/0 handle=0xf44b2930
  | state=S schedstat=( 202455359 15652502 1096 ) utm=15 stm=6 core=7 HZ=100
  | stack=0xf43b0000-0xf43b2000 stackSize=1038KB
  | held mutexes=
  at java.lang.Object.wait! (Native method)
- waiting on <0x0666cd55> (a java.lang.ref.ReferenceQueue)
  at java.lang.Object.wait (Object.java:423)
  at java.lang.ref.ReferenceQueue.remove (ReferenceQueue.java:101)
- locked <0x0666cd55> (a java.lang.ref.ReferenceQueue)
  at java.lang.ref.ReferenceQueue.remove (ReferenceQueue.java:72)
  at java.lang.Daemons$FinalizerDaemon.run (Daemons.java:200)
  at java.lang.Thread.run (Thread.java:818)


"FinalizerWatchdogDaemon" daemon prio=5 tid=5 Sleeping
  | group="system" sCount=1 dsCount=0 obj=0x12c55700 self=0xab2e33a8
  | sysTid=20147 nice=0 cgrp=default sched=0/0 handle=0xf43ad930
  | state=S schedstat=( 11755408 4372035 128 ) utm=0 stm=1 core=6 HZ=100
  | stack=0xf42ab000-0xf42ad000 stackSize=1038KB
  | held mutexes=
  at java.lang.Thread.sleep! (Native method)
- sleeping on <0x0113836a> (a java.lang.Object)
  at java.lang.Thread.sleep (Thread.java:1031)
- locked <0x0113836a> (a java.lang.Object)
  at java.lang.Thread.sleep (Thread.java:985)
  at java.lang.Daemons$FinalizerWatchdogDaemon.sleepFor (Daemons.java:288)
  at java.lang.Daemons$FinalizerWatchdogDaemon.waitForFinalization (Daemons.java:299)
  at java.lang.Daemons$FinalizerWatchdogDaemon.run (Daemons.java:247)
  at java.lang.Thread.run (Thread.java:818)


"Binder_1" prio=5 tid=7 Native
  | group="main" sCount=1 dsCount=0 obj=0x12c5f0a0 self=0xab2ec658
  | sysTid=20149 nice=0 cgrp=default sched=0/0 handle=0xf40a5930
  | state=S schedstat=( 83224694 45127544 556 ) utm=3 stm=5 core=4 HZ=100
  | stack=0xf3fa9000-0xf3fab000 stackSize=1014KB
  | held mutexes=
  #00  pc 0000000000042d9c  /system/lib/libc.so (__ioctl+8)
  #01  pc 000000000004989d  /system/lib/libc.so (ioctl+14)
  #02  pc 000000000001e947  /system/lib/libbinder.so (_ZN7android14IPCThreadState14talkWithDriverEb+174)
  #03  pc 000000000001eea7  /system/lib/libbinder.so (_ZN7android14IPCThreadState20getAndExecuteCommandEv+6)
  #04  pc 000000000001ef45  /system/lib/libbinder.so (_ZN7android14IPCThreadState14joinThreadPoolEb+48)
  #05  pc 0000000000023a11  /system/lib/libbinder.so (???)
  #06  pc 000000000001011d  /system/lib/libutils.so (_ZN7android6Thread11_threadLoopEPv+112)
  #07  pc 000000000006082f  /system/lib/libandroid_runtime.so (_ZN7android14AndroidRuntime15javaThreadShellEPv+70)
  #08  pc 0000000000041833  /system/lib/libc.so (_ZL15__pthread_startPv+30)
  #09  pc 0000000000019335  /system/lib/libc.so (__start_thread+6)


"Binder_2" prio=5 tid=8 Native
  | group="main" sCount=1 dsCount=0 obj=0x12c6a0a0 self=0xab2dedc8
  | sysTid=20150 nice=0 cgrp=default sched=0/0 handle=0xf3fa6930
  | state=S schedstat=( 86105629 40224422 567 ) utm=3 stm=5 core=6 HZ=100
  | stack=0xf3eaa000-0xf3eac000 stackSize=1014KB
  | held mutexes=
  #00  pc 0000000000042d9c  /system/lib/libc.so (__ioctl+8)
  #01  pc 000000000004989d  /system/lib/libc.so (ioctl+14)
  #02  pc 000000000001e947  /system/lib/libbinder.so (_ZN7android14IPCThreadState14talkWithDriverEb+174)
  #03  pc 000000000001eea7  /system/lib/libbinder.so (_ZN7android14IPCThreadState20getAndExecuteCommandEv+6)
  #04  pc 000000000001ef45  /system/lib/libbinder.so (_ZN7android14IPCThreadState14joinThreadPoolEb+48)
  #05  pc 0000000000023a11  /system/lib/libbinder.so (???)
  #06  pc 000000000001011d  /system/lib/libutils.so (_ZN7android6Thread11_threadLoopEPv+112)
  #07  pc 000000000006082f  /system/lib/libandroid_runtime.so (_ZN7android14AndroidRuntime15javaThreadShellEPv+70)
  #08  pc 0000000000041833  /system/lib/libc.so (_ZL15__pthread_startPv+30)
  #09  pc 0000000000019335  /system/lib/libc.so (__start_thread+6)

"Thread-966" prio=5 tid=9 Native
  | group="main" sCount=1 dsCount=0 obj=0x12d510a0 self=0xab339dd0
  | sysTid=20152 nice=0 cgrp=default sched=0/0 handle=0xef27f930
  | state=S schedstat=( 432680303 308431515 2375 ) utm=26 stm=17 core=4 HZ=100
  | stack=0xef181000-0xef183000 stackSize=1022KB
  | held mutexes=
  #00  pc 0000000000016998  /system/lib/libc.so (syscall+28)
  #01  pc 000000000001bc8d  /system/lib/libc.so (sem_wait+62)
  #02  pc 0000000000234244  /data/app/com.jafaria.app-2/lib/arm/libmonosgen-2.0.so (???)

1 个答案:

答案 0 :(得分:0)

因为您使用C#/ Mono编写,所以Android Stack跟踪不会向您显示代码冻结的位置。您刚刚得到的堆栈跟踪表明,您的代码正在主(UI)线程上运行某些单声道代码,并且该代码被锁定了500毫秒(半秒)以上。

通常的问题是在UI线程中执行某些操作,这需要很多时间。可能是:

  • 读取或写入磁盘或数据库
  • 网络访问
  • 大量复杂的计算

我建议您看一下这个StackOverflow问题,该问题为您提供了获得Xamarin stack track的Android ANR的方法。