0

So I have gotten ANRs a lot since about a month ago. When it should've been any kind of uncaught exception, my app goes ANR. I tried making my app crash by doing things which will easily cause NPE (using a method in an adapter which hasn't been instantiated and stuffs like this) and it just goes ANR.

I am at loss on where the problem is. When I googled, it only shows that ANR is caused by GoogleAnalytics? I haven't worked with that..

EDIT : This is not a simple ANR. It'd be tracable easier if it were like that, as I wrote, when I try making it NPE, it goes ANR, what else do I need to say in order to explain the situation? Was I not clear enough? If yes, please tell me what else do I need to tell because I gotta update the app soon lol

UPDATE 11/29/'16 10:32 AM :

I used ANRWatchDog to check what's happening with my app, and I got this

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) 

There are 3 more AsyncTask waiting below those 2..

It happened all of a sudden around 2 weeks ago and I haven't found the root problem yet..

Kevin Murvie
  • 2,592
  • 1
  • 25
  • 43
  • Possible duplicate of [Android - how do I investigate an ANR?](http://stackoverflow.com/questions/704311/android-how-do-i-investigate-an-anr) – Chisko Nov 25 '16 at 03:29
  • We can't help either, we do not even know what is your app, what it does, no code provided (I am expecting it is big) and lastly no stacktrace. :) You really need someone to look your whole code in that case. – Enzokie Nov 25 '16 at 04:00
  • @Enzokie Thank you, so about codes, I don't know what to give because it happened when I don't even know it, it is a combination of social media and marketplace and yes it is big, stacktrace is a problem, my logcat doesn't show a single thing. I used internal logging and it shows the problem well enough for my deliberate NPE but not the logcat.. – Kevin Murvie Nov 25 '16 at 04:11
  • About logcat doesn't show a single thing, it was a filter mistake, silly, but still it doesn't show that I actually get an NPE, but directly ANR my app – Kevin Murvie Nov 25 '16 at 04:42
  • In light of symptoms you are describing, I would start by looking at all places where `Object#wait()` method is being invoked - it might be the case that you block UI thread, and NPE prevents this block from being released, which leads to ANR. – Vasiliy Nov 29 '16 at 05:44
  • @VasiliyHmm can you give me an example of where it could be used? Because I've never added that code into my app.. I'll test it in another activity, maybe it's only in that certain Activity – Kevin Murvie Nov 29 '16 at 06:40
  • @VasiliyAfter tracking it down, I found it. It was the error log which one of my buddies added. It logs the error and store it in a file, which causes ANR due to some modifications done to it recently... – Kevin Murvie Dec 01 '16 at 03:39

0 Answers0