Android - 当遇到NPE时,我的应用程序会转到ANR而不是NPE

时间:2016-11-25 03:16:36

标签: android android-anr-dialog

因此,大约一个月前我就收到了很多ANR。什么时候它应该是任何未被捕获的异常,我的应用程序是ANR。我尝试通过做一些很容易导致NPE的事情来使我的应用程序崩溃(使用未经实例化的适配器中的方法和类似的东西)并且它只是ANR。

我对问题出在哪里感到茫然。当我用Google搜索时,它只显示ANR是由GoogleAnalytics引起的?我还没有用过......

编辑: 这不是一个简单的ANR。如果是这样的话,它会更容易追踪,就像我写的那样,当我尝试制作NPE时,它会变成ANR,为了解释这种情况我还需要说些什么呢?我不够清楚吗?如果是,请告诉我还有什么需要告诉我因为我必须尽快更新应用程序lol

更新11/29 /' 16 10:32 AM:

我使用ANRWatchDog检查我的应用程序发生了什么,我得到了这个

FATAL EXCEPTION: |ANR-WatchDog|
Process: com.km.test, PID: 31207
com.github.anrwatchdog.ANRError: Application Not Responding
Caused by: com.github.anrwatchdog.ANRError$$$_Thread: main (state = NEW)
Caused by: com.github.anrwatchdog.ANRError$$$_Thread: AsyncTask #1 (state = WAITING)
    at java.lang.Object.wait(Native Method)
    at java.lang.Thread.parkFor(Thread.java:1205)
    at sun.misc.Unsafe.park(Unsafe.java:325)
    at java.util.concurrent.locks.LockSupport.park(LockSupport.java:157)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2017)
    at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:410)
    at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1035)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1097)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
    at java.lang.Thread.run(Thread.java:841)
 Caused by: com.github.anrwatchdog.ANRError$$$_Thread: AsyncTask #2 (state = WAITING)
    at java.lang.Object.wait(Native Method) 
    at java.lang.Thread.parkFor(Thread.java:1205) 
    at sun.misc.Unsafe.park(Unsafe.java:325) 
    at java.util.concurrent.locks.LockSupport.park(LockSupport.java:157) 
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2017) 
    at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:410) 
    at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1035) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1097) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 
    at java.lang.Thread.run(Thread.java:841) 

还有3个AsyncTask等待那些2 ..

大概在两周前突然发生了,我还没有找到根本问题..

0 个答案:

没有答案