Tuesday, 12 July 2016

Robolectric - Figure out the error trace when the tests gets stack

Running robolectric helps to do the unit testing on Android faster, but there were several cases when it runs and it seems to get stuck on some point. To know what is happening, do the follow:

1. First try, running it on you terminal
1.1 Copy the execution code in the corresponding windows:


1.2 Paste it into the terminal
1.3 If you don't see anything, get the pid of the process by running:

ps -A | grep java

1.4 Get the pid and run

jstack PID

Where PID is the id of the java process we got from step 1.3.

It should show something like follow. In this case we have a deadlock related with Google GTM SDK timer:

2016-07-12 11:38:01
Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.91-b14 mixed mode):

"Attach Listener" #47 daemon prio=9 os_prio=31 tid=0x00007fd0e7537000 nid=0x830f waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Google GTM SDK Timer" #46 prio=5 os_prio=31 tid=0x00007fd0e3c85800 nid=0x8c07 in Object.wait() [0x0000700002f20000]
   java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x000000077f905de0> (a android.os.Looper)
at java.lang.Object.wait(Object.java:502)
at org.robolectric.shadows.ShadowLooper.doLoop(ShadowLooper.java:100)
- locked <0x000000077f905de0> (a android.os.Looper)
at org.robolectric.shadows.ShadowLooper.loop(ShadowLooper.java:92)
at java.lang.invoke.LambdaForm$DMH/644460953.invokeStatic__V(LambdaForm$DMH)
at java.lang.invoke.LambdaForm$reinvoker/1484171695.dontInline(LambdaForm$reinvoker)
at java.lang.invoke.LambdaForm$MH/2127036371.guard(LambdaForm$MH)
at java.lang.invoke.LambdaForm$MH/1529060733.linkToCallSite(LambdaForm$MH)
at android.os.Looper.loop(Looper.java)
at android.os.HandlerThread.$$robo$$run(HandlerThread.java:61)
at java.lang.invoke.LambdaForm$DMH/615634843.invokeSpecial_L_V(LambdaForm$DMH)
at java.lang.invoke.LambdaForm$MH/1832580921.guardWithCatch(LambdaForm$MH)
at java.lang.invoke.LambdaForm$reinvoker/1902260856.dontInline(LambdaForm$reinvoker)
at java.lang.invoke.LambdaForm$MH/1988859660.guard(LambdaForm$MH)
at java.lang.invoke.LambdaForm$MH/1514160588.linkToCallSite(LambdaForm$MH)
at android.os.HandlerThread.run(HandlerThread.java)

"Google GTM SDK Timer" #45 prio=5 os_prio=31 tid=0x00007fd0e33f9000 nid=0x8b07 in Object.wait() [0x0000700002d1a000]
   java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x000000077e78de40> (a android.os.Looper)
at java.lang.Object.wait(Object.java:502)
at org.robolectric.shadows.ShadowLooper.doLoop(ShadowLooper.java:100)
- locked <0x000000077e78de40> (a android.os.Looper)
at org.robolectric.shadows.ShadowLooper.loop(ShadowLooper.java:92)
at java.lang.invoke.LambdaForm$DMH/644460953.invokeStatic__V(LambdaForm$DMH)
at java.lang.invoke.LambdaForm$reinvoker/1484171695.dontInline(LambdaForm$reinvoker)
at java.lang.invoke.LambdaForm$MH/2127036371.guard(LambdaForm$MH)
at java.lang.invoke.LambdaForm$MH/1529060733.linkToCallSite(LambdaForm$MH)
at android.os.Looper.loop(Looper.java)
at android.os.HandlerThread.$$robo$$run(HandlerThread.java:61)
at java.lang.invoke.LambdaForm$DMH/615634843.invokeSpecial_L_V(LambdaForm$DMH)
at java.lang.invoke.LambdaForm$MH/1832580921.guardWithCatch(LambdaForm$MH)
at java.lang.invoke.LambdaForm$reinvoker/1902260856.dontInline(LambdaForm$reinvoker)
at java.lang.invoke.LambdaForm$MH/1988859660.guard(LambdaForm$MH)
at java.lang.invoke.LambdaForm$MH/1514160588.linkToCallSite(LambdaForm$MH)
at android.os.HandlerThread.run(HandlerThread.java)

"Subscribe-Manager-1572582034-3" #41 prio=5 os_prio=31 tid=0x00007fd0e721d800 nid=0x8903 in Object.wait() [0x0000700002e1d000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at com.pubnub.api.Worker.run(Unknown Source)
- locked <0x000000076b291f28> (a java.util.Vector)
at java.lang.Thread.run(Thread.java:745)

"Non-Subscribe-Manager-1572582034-2" #39 prio=5 os_prio=31 tid=0x00007fd0e5b9c000 nid=0x8503 in Object.wait() [0x0000700002c17000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at com.pubnub.api.Worker.run(Unknown Source)
- locked <0x000000076b3828e0> (a java.util.Vector)
at java.lang.Thread.run(Thread.java:745)

"Thread-13" #37 prio=5 os_prio=31 tid=0x00007fd0e6a77000 nid=0x8103 waiting on condition [0x0000700002a11000]
   java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x00000006c520efe0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:549)
at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)

"Thread-12" #36 prio=5 os_prio=31 tid=0x00007fd0e6a35000 nid=0x7f03 waiting on condition [0x000070000290e000]
   java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x00000006c520efe0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:549)
at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)

"Thread-11" #35 prio=5 os_prio=31 tid=0x00007fd0e4386800 nid=0x7d03 waiting on condition [0x000070000280b000]
   java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x00000006c520efe0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:549)
at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)

"Thread-10" #34 prio=5 os_prio=31 tid=0x00007fd0e4386000 nid=0x7b03 waiting on condition [0x0000700002708000]
   java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x00000006c520efe0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:549)
at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)

"Thread-9" #33 prio=5 os_prio=31 tid=0x00007fd0e4385000 nid=0x7903 waiting on condition [0x0000700002605000]
   java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x00000006c520efe0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:549)
at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)

"Thread-8" #32 prio=5 os_prio=31 tid=0x00007fd0e4384800 nid=0x7703 waiting on condition [0x0000700002502000]
   java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x00000006c520efe0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:549)
at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)

"Thread-7" #31 prio=5 os_prio=31 tid=0x00007fd0e411a000 nid=0x7503 waiting on condition [0x00007000023ff000]
   java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x00000006c520efe0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:549)
at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)

"Thread-6" #30 prio=5 os_prio=31 tid=0x00007fd0e3767800 nid=0x7303 waiting on condition [0x00007000022fc000]
   java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x00000006c520efe0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:549)
at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)

"Thread-5" #29 prio=5 os_prio=31 tid=0x00007fd0e4119000 nid=0x7103 waiting on condition [0x00007000021f9000]
   java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x00000006c520efe0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:549)
at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)

"Thread-4" #28 prio=5 os_prio=31 tid=0x00007fd0e4118800 nid=0x6f03 waiting on condition [0x00007000020f6000]
   java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x00000006c520efe0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:549)
at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)

"Thread-3" #27 prio=5 os_prio=31 tid=0x00007fd0e42a8000 nid=0x6d03 waiting on condition [0x0000700001ff3000]
   java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x00000006c520eb78> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:549)
at com.android.volley.CacheDispatcher.run(CacheDispatcher.java:90)

"pool-8-thread-1" #26 prio=5 os_prio=31 tid=0x00007fd0e2aa1800 nid=0x6b03 waiting for monitor entry [0x0000700001eef000]
   java.lang.Thread.State: BLOCKED (on object monitor)
at org.robolectric.util.Scheduler.remove(Scheduler.java:166)
- waiting to lock <0x00000006c0066740> (a org.robolectric.util.Scheduler)
at org.robolectric.shadows.ShadowMessage.unschedule(ShadowMessage.java:33)
at org.robolectric.shadows.ShadowMessage.recycleUnchecked(ShadowMessage.java:47)
at java.lang.invoke.LambdaForm$DMH/809300666.invokeVirtual_L_V(LambdaForm$DMH)
at java.lang.invoke.LambdaForm$BMH/1984513847.reinvoke(LambdaForm$BMH)
at java.lang.invoke.LambdaForm$MH/211968962.delegate(LambdaForm$MH)
at java.lang.invoke.LambdaForm$MH/1988859660.guard(LambdaForm$MH)
at java.lang.invoke.LambdaForm$MH/1514160588.linkToCallSite(LambdaForm$MH)
at android.os.Message.recycleUnchecked(Message.java)
at android.os.MessageQueue.$$robo$$removeMessages(MessageQueue.java:439)
- locked <0x00000006c1194b88> (a android.os.MessageQueue)
at java.lang.invoke.LambdaForm$DMH/1147805316.invokeSpecial_LLIL_V(LambdaForm$DMH)
at java.lang.invoke.LambdaForm$MH/2131465140.guardWithCatch(LambdaForm$MH)
at java.lang.invoke.LambdaForm$reinvoker/1905252289.dontInline(LambdaForm$reinvoker)
at java.lang.invoke.LambdaForm$MH/1271323139.guard(LambdaForm$MH)
at java.lang.invoke.LambdaForm$MH/1331275030.linkToCallSite(LambdaForm$MH)
at android.os.MessageQueue.removeMessages(MessageQueue.java)
at android.os.Handler.$$robo$$removeMessages(Handler.java:639)
at java.lang.invoke.LambdaForm$DMH/1906808037.invokeSpecial_LI_V(LambdaForm$DMH)
at java.lang.invoke.LambdaForm$MH/599491651.guardWithCatch(LambdaForm$MH)
at java.lang.invoke.LambdaForm$reinvoker/624271064.dontInline(LambdaForm$reinvoker)
at java.lang.invoke.LambdaForm$MH/564742142.guard(LambdaForm$MH)
at java.lang.invoke.LambdaForm$MH/90205195.linkToCallSite(LambdaForm$MH)
at android.os.Handler.removeMessages(Handler.java)
at com.google.android.gms.internal.zzly$zza.zzoS(Unknown Source)
at com.google.android.gms.internal.zzly.zzc(Unknown Source)
at com.google.android.gms.internal.zzly.zzb(Unknown Source)
- locked <0x00000006c3ed6f70> (a java.lang.Object)
at com.google.android.gms.tagmanager.zzp.zza(Unknown Source)
- locked <0x00000006c3ed6ef0> (a com.google.android.gms.tagmanager.zzp)
at com.google.android.gms.tagmanager.zzp.zza(Unknown Source)
at com.google.android.gms.tagmanager.zzp$zzc.zzb(Unknown Source)
- locked <0x00000006c3ed6ef0> (a com.google.android.gms.tagmanager.zzp)
at com.google.android.gms.tagmanager.zzp$zzc.zzI(Unknown Source)
at com.google.android.gms.tagmanager.zzcl.zzFc(Unknown Source)
at com.google.android.gms.tagmanager.zzcl.run(Unknown Source)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

"pool-7-thread-1" #25 prio=5 os_prio=31 tid=0x00007fd0e604f000 nid=0x6903 waiting on condition [0x0000700001ded000]
   java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x00000006c3ed7160> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

"Google GTM SDK Timer" #24 prio=5 os_prio=31 tid=0x00007fd0e5841000 nid=0x6703 in Object.wait() [0x0000700001cea000]
   java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x00000006c3ea8518> (a android.os.Looper)
at java.lang.Object.wait(Object.java:502)
at org.robolectric.shadows.ShadowLooper.doLoop(ShadowLooper.java:100)
- locked <0x00000006c3ea8518> (a android.os.Looper)
at org.robolectric.shadows.ShadowLooper.loop(ShadowLooper.java:92)
at java.lang.invoke.LambdaForm$DMH/644460953.invokeStatic__V(LambdaForm$DMH)
at java.lang.invoke.LambdaForm$reinvoker/1484171695.dontInline(LambdaForm$reinvoker)
at java.lang.invoke.LambdaForm$MH/2127036371.guard(LambdaForm$MH)
at java.lang.invoke.LambdaForm$MH/1529060733.linkToCallSite(LambdaForm$MH)
at android.os.Looper.loop(Looper.java)
at android.os.HandlerThread.$$robo$$run(HandlerThread.java:61)
at java.lang.invoke.LambdaForm$DMH/615634843.invokeSpecial_L_V(LambdaForm$DMH)
at java.lang.invoke.LambdaForm$MH/1832580921.guardWithCatch(LambdaForm$MH)
at java.lang.invoke.LambdaForm$reinvoker/1902260856.dontInline(LambdaForm$reinvoker)
at java.lang.invoke.LambdaForm$MH/1988859660.guard(LambdaForm$MH)
at java.lang.invoke.LambdaForm$MH/1514160588.linkToCallSite(LambdaForm$MH)
at android.os.HandlerThread.run(HandlerThread.java)

"pool-5-thread-1" #23 prio=5 os_prio=31 tid=0x00007fd0e8e17800 nid=0x6503 waiting for monitor entry [0x0000700001be6000]
   java.lang.Thread.State: BLOCKED (on object monitor)
at android.os.MessageQueue.$$robo$$removeMessages(MessageQueue.java:421)
- waiting to lock <0x00000006c1194b88> (a android.os.MessageQueue)
at java.lang.invoke.LambdaForm$DMH/1147805316.invokeSpecial_LLIL_V(LambdaForm$DMH)
at java.lang.invoke.LambdaForm$MH/2131465140.guardWithCatch(LambdaForm$MH)
at java.lang.invoke.LambdaForm$reinvoker/1905252289.dontInline(LambdaForm$reinvoker)
at java.lang.invoke.LambdaForm$MH/1271323139.guard(LambdaForm$MH)
at java.lang.invoke.LambdaForm$MH/1331275030.linkToCallSite(LambdaForm$MH)
at android.os.MessageQueue.removeMessages(MessageQueue.java)
at android.os.Handler.$$robo$$removeMessages(Handler.java:639)
at java.lang.invoke.LambdaForm$DMH/1906808037.invokeSpecial_LI_V(LambdaForm$DMH)
at java.lang.invoke.LambdaForm$MH/599491651.guardWithCatch(LambdaForm$MH)
at java.lang.invoke.LambdaForm$reinvoker/624271064.dontInline(LambdaForm$reinvoker)
at java.lang.invoke.LambdaForm$MH/564742142.guard(LambdaForm$MH)
at java.lang.invoke.LambdaForm$MH/90205195.linkToCallSite(LambdaForm$MH)
at android.os.Handler.removeMessages(Handler.java)
at com.google.android.gms.internal.zzly$zza.zzoS(Unknown Source)
at com.google.android.gms.internal.zzly.zzc(Unknown Source)
at com.google.android.gms.internal.zzly.zzb(Unknown Source)
- locked <0x00000006c3dd98a8> (a java.lang.Object)
at com.google.android.gms.tagmanager.zzp.zza(Unknown Source)
- locked <0x00000006c3dd9828> (a com.google.android.gms.tagmanager.zzp)
at com.google.android.gms.tagmanager.zzp.zza(Unknown Source)
at com.google.android.gms.tagmanager.zzp$zzc.zzb(Unknown Source)
- locked <0x00000006c3dd9828> (a com.google.android.gms.tagmanager.zzp)
at com.google.android.gms.tagmanager.zzp$zzc.zzI(Unknown Source)
at com.google.android.gms.tagmanager.zzcl.zzFc(Unknown Source)
at com.google.android.gms.tagmanager.zzcl.run(Unknown Source)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

"pool-4-thread-1" #22 prio=5 os_prio=31 tid=0x00007fd0e648d800 nid=0x6303 waiting on condition [0x0000700001ae4000]
   java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x00000006c3ed7cf8> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

"Thread-2" #21 prio=5 os_prio=31 tid=0x00007fd0e807d800 nid=0x6103 in Object.wait() [0x00007000019e1000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x00000006c3e3f598> (a java.lang.Object)
at com.google.android.gms.tagmanager.zza.zzDY(Unknown Source)
- locked <0x00000006c3e3f598> (a java.lang.Object)
at com.google.android.gms.tagmanager.zza.zzb(Unknown Source)
at com.google.android.gms.tagmanager.zza$2.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)

"Google GTM SDK Timer" #20 prio=5 os_prio=31 tid=0x00007fd0e7d2b000 nid=0x5d07 in Object.wait() [0x00007000018de000]
   java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x00000006c3e34558> (a android.os.Looper)
at java.lang.Object.wait(Object.java:502)
at org.robolectric.shadows.ShadowLooper.doLoop(ShadowLooper.java:100)
- locked <0x00000006c3e34558> (a android.os.Looper)
at org.robolectric.shadows.ShadowLooper.loop(ShadowLooper.java:92)
at java.lang.invoke.LambdaForm$DMH/644460953.invokeStatic__V(LambdaForm$DMH)
at java.lang.invoke.LambdaForm$reinvoker/1484171695.dontInline(LambdaForm$reinvoker)
at java.lang.invoke.LambdaForm$MH/2127036371.guard(LambdaForm$MH)
at java.lang.invoke.LambdaForm$MH/1529060733.linkToCallSite(LambdaForm$MH)
at android.os.Looper.loop(Looper.java)
at android.os.HandlerThread.$$robo$$run(HandlerThread.java:61)
at java.lang.invoke.LambdaForm$DMH/615634843.invokeSpecial_L_V(LambdaForm$DMH)
at java.lang.invoke.LambdaForm$MH/1832580921.guardWithCatch(LambdaForm$MH)
at java.lang.invoke.LambdaForm$reinvoker/1902260856.dontInline(LambdaForm$reinvoker)
at java.lang.invoke.LambdaForm$MH/1988859660.guard(LambdaForm$MH)
at java.lang.invoke.LambdaForm$MH/1514160588.linkToCallSite(LambdaForm$MH)
at android.os.HandlerThread.run(HandlerThread.java)

"pool-3-thread-1" #19 prio=5 os_prio=31 tid=0x00007fd0e7532000 nid=0x5f07 waiting on condition [0x00007000017db000]
   java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x00000006c3dd9cd8> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

"pool-2-thread-1" #18 prio=5 os_prio=31 tid=0x00007fd0e7c87000 nid=0x5a13 waiting on condition [0x00007000016d8000]
   java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x00000006c0035db8> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

"Monitor Ctrl-Break" #10 daemon prio=5 os_prio=31 tid=0x00007fd0e2832000 nid=0x5603 runnable [0x00007000015d5000]
   java.lang.Thread.State: RUNNABLE
at java.net.PlainSocketImpl.socketAccept(Native Method)
at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:409)
at java.net.ServerSocket.implAccept(ServerSocket.java:545)
at java.net.ServerSocket.accept(ServerSocket.java:513)
at com.intellij.rt.execution.application.AppMain$1.run(AppMain.java:90)
at java.lang.Thread.run(Thread.java:745)

"Service Thread" #9 daemon prio=9 os_prio=31 tid=0x00007fd0e5802000 nid=0x5203 runnable [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"C1 CompilerThread3" #8 daemon prio=9 os_prio=31 tid=0x00007fd0e6014000 nid=0x5003 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"C2 CompilerThread2" #7 daemon prio=9 os_prio=31 tid=0x00007fd0e6003800 nid=0x4e03 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"C2 CompilerThread1" #6 daemon prio=9 os_prio=31 tid=0x00007fd0e6002800 nid=0x4c03 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"C2 CompilerThread0" #5 daemon prio=9 os_prio=31 tid=0x00007fd0e6001000 nid=0x4a03 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Signal Dispatcher" #4 daemon prio=9 os_prio=31 tid=0x00007fd0e6000000 nid=0x3e0f runnable [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Finalizer" #3 daemon prio=8 os_prio=31 tid=0x00007fd0e300c000 nid=0x3803 in Object.wait() [0x0000700000d3a000]
   java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x00000006c078fd10> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
- locked <0x00000006c078fd10> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:164)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:209)

"Reference Handler" #2 daemon prio=10 os_prio=31 tid=0x00007fd0e3009800 nid=0x3603 in Object.wait() [0x0000700000c37000]
   java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x00000006c07a89d8> (a java.lang.ref.Reference$Lock)
at java.lang.Object.wait(Object.java:502)
at java.lang.ref.Reference.tryHandlePending(Reference.java:191)
- locked <0x00000006c07a89d8> (a java.lang.ref.Reference$Lock)
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:153)

"main" #1 prio=5 os_prio=31 tid=0x00007fd0e2812800 nid=0x1703 waiting for monitor entry [0x0000700000217000]
   java.lang.Thread.State: BLOCKED (on object monitor)
at org.robolectric.shadows.ShadowMessageQueue$1.run(ShadowMessageQueue.java:96)
- waiting to lock <0x00000006c1194b88> (a android.os.MessageQueue)
at org.robolectric.util.Scheduler$ScheduledRunnable.run(Scheduler.java:335)
at org.robolectric.util.Scheduler.runOneTask(Scheduler.java:237)
- locked <0x00000006c0066740> (a org.robolectric.util.Scheduler)
at org.robolectric.util.Scheduler.advanceTo(Scheduler.java:218)
- locked <0x00000006c0066740> (a org.robolectric.util.Scheduler)
at org.robolectric.util.Scheduler.advanceBy(Scheduler.java:201)
- locked <0x00000006c0066740> (a org.robolectric.util.Scheduler)
at org.robolectric.util.Scheduler.setIdleState(Scheduler.java:78)
- locked <0x00000006c0066740> (a org.robolectric.util.Scheduler)
at org.robolectric.util.Scheduler.unPause(Scheduler.java:112)
- locked <0x00000006c0066740> (a org.robolectric.util.Scheduler)
at org.robolectric.shadows.ShadowLooper.unPause(ShadowLooper.java:291)
at org.robolectric.shadows.ShadowLooper.runPaused(ShadowLooper.java:342)
at org.robolectric.shadows.CoreShadowsAdapter$2.runPaused(CoreShadowsAdapter.java:40)
at org.robolectric.util.ActivityController.create(ActivityController.java:130)
at org.robolectric.util.ActivityController.create(ActivityController.java:140)
at org.robolectric.util.ActivityController.setup(ActivityController.java:234)
at org.robolectric.Robolectric.setupActivity(Robolectric.java:86)
at com.dubizzle.horizontal.activities.MainActivityTest.setUp(MainActivityTest.java:29)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:265)
at org.robolectric.RobolectricTestRunner.runChild(RobolectricTestRunner.java:191)
at org.robolectric.RobolectricTestRunner.runChild(RobolectricTestRunner.java:56)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:157)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

"VM Thread" os_prio=31 tid=0x00007fd0e385f800 nid=0x3403 runnable

"GC task thread#0 (ParallelGC)" os_prio=31 tid=0x00007fd0e5004800 nid=0x2403 runnable

"GC task thread#1 (ParallelGC)" os_prio=31 tid=0x00007fd0e5005800 nid=0x2603 runnable

"GC task thread#2 (ParallelGC)" os_prio=31 tid=0x00007fd0e5006000 nid=0x2803 runnable

"GC task thread#3 (ParallelGC)" os_prio=31 tid=0x00007fd0e5006800 nid=0x2a03 runnable

"GC task thread#4 (ParallelGC)" os_prio=31 tid=0x00007fd0e5007000 nid=0x2c03 runnable

"GC task thread#5 (ParallelGC)" os_prio=31 tid=0x00007fd0e3809000 nid=0x2e03 runnable

"GC task thread#6 (ParallelGC)" os_prio=31 tid=0x00007fd0e380e800 nid=0x3003 runnable

"GC task thread#7 (ParallelGC)" os_prio=31 tid=0x00007fd0e380f000 nid=0x3203 runnable

"VM Periodic Task Thread" os_prio=31 tid=0x00007fd0e4002000 nid=0x5403 waiting on condition

JNI global references: 4095


Found one Java-level deadlock:
=============================
"pool-8-thread-1":
  waiting to lock monitor 0x00007fd0e7cea268 (object 0x00000006c0066740, a org.robolectric.util.Scheduler),
  which is held by "main"
"main":
  waiting to lock monitor 0x00007fd0e7ce9978 (object 0x00000006c1194b88, a android.os.MessageQueue),
  which is held by "pool-8-thread-1"

Java stack information for the threads listed above:
===================================================
"pool-8-thread-1":
at org.robolectric.util.Scheduler.remove(Scheduler.java:166)
- waiting to lock <0x00000006c0066740> (a org.robolectric.util.Scheduler)
at org.robolectric.shadows.ShadowMessage.unschedule(ShadowMessage.java:33)
at org.robolectric.shadows.ShadowMessage.recycleUnchecked(ShadowMessage.java:47)
at java.lang.invoke.LambdaForm$DMH/809300666.invokeVirtual_L_V(LambdaForm$DMH)
at java.lang.invoke.LambdaForm$BMH/1984513847.reinvoke(LambdaForm$BMH)
at java.lang.invoke.LambdaForm$MH/211968962.delegate(LambdaForm$MH)
at java.lang.invoke.LambdaForm$MH/1988859660.guard(LambdaForm$MH)
at java.lang.invoke.LambdaForm$MH/1514160588.linkToCallSite(LambdaForm$MH)
at android.os.Message.recycleUnchecked(Message.java)
at android.os.MessageQueue.$$robo$$removeMessages(MessageQueue.java:439)
- locked <0x00000006c1194b88> (a android.os.MessageQueue)
at java.lang.invoke.LambdaForm$DMH/1147805316.invokeSpecial_LLIL_V(LambdaForm$DMH)
at java.lang.invoke.LambdaForm$MH/2131465140.guardWithCatch(LambdaForm$MH)
at java.lang.invoke.LambdaForm$reinvoker/1905252289.dontInline(LambdaForm$reinvoker)
at java.lang.invoke.LambdaForm$MH/1271323139.guard(LambdaForm$MH)
at java.lang.invoke.LambdaForm$MH/1331275030.linkToCallSite(LambdaForm$MH)
at android.os.MessageQueue.removeMessages(MessageQueue.java)
at android.os.Handler.$$robo$$removeMessages(Handler.java:639)
at java.lang.invoke.LambdaForm$DMH/1906808037.invokeSpecial_LI_V(LambdaForm$DMH)
at java.lang.invoke.LambdaForm$MH/599491651.guardWithCatch(LambdaForm$MH)
at java.lang.invoke.LambdaForm$reinvoker/624271064.dontInline(LambdaForm$reinvoker)
at java.lang.invoke.LambdaForm$MH/564742142.guard(LambdaForm$MH)
at java.lang.invoke.LambdaForm$MH/90205195.linkToCallSite(LambdaForm$MH)
at android.os.Handler.removeMessages(Handler.java)
at com.google.android.gms.internal.zzly$zza.zzoS(Unknown Source)
at com.google.android.gms.internal.zzly.zzc(Unknown Source)
at com.google.android.gms.internal.zzly.zzb(Unknown Source)
- locked <0x00000006c3ed6f70> (a java.lang.Object)
at com.google.android.gms.tagmanager.zzp.zza(Unknown Source)
- locked <0x00000006c3ed6ef0> (a com.google.android.gms.tagmanager.zzp)
at com.google.android.gms.tagmanager.zzp.zza(Unknown Source)
at com.google.android.gms.tagmanager.zzp$zzc.zzb(Unknown Source)
- locked <0x00000006c3ed6ef0> (a com.google.android.gms.tagmanager.zzp)
at com.google.android.gms.tagmanager.zzp$zzc.zzI(Unknown Source)
at com.google.android.gms.tagmanager.zzcl.zzFc(Unknown Source)
at com.google.android.gms.tagmanager.zzcl.run(Unknown Source)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
"main":
at org.robolectric.shadows.ShadowMessageQueue$1.run(ShadowMessageQueue.java:96)
- waiting to lock <0x00000006c1194b88> (a android.os.MessageQueue)
at org.robolectric.util.Scheduler$ScheduledRunnable.run(Scheduler.java:335)
at org.robolectric.util.Scheduler.runOneTask(Scheduler.java:237)
- locked <0x00000006c0066740> (a org.robolectric.util.Scheduler)
at org.robolectric.util.Scheduler.advanceTo(Scheduler.java:218)
- locked <0x00000006c0066740> (a org.robolectric.util.Scheduler)
at org.robolectric.util.Scheduler.advanceBy(Scheduler.java:201)
- locked <0x00000006c0066740> (a org.robolectric.util.Scheduler)
at org.robolectric.util.Scheduler.setIdleState(Scheduler.java:78)
- locked <0x00000006c0066740> (a org.robolectric.util.Scheduler)
at org.robolectric.util.Scheduler.unPause(Scheduler.java:112)
- locked <0x00000006c0066740> (a org.robolectric.util.Scheduler)
at org.robolectric.shadows.ShadowLooper.unPause(ShadowLooper.java:291)
at org.robolectric.shadows.ShadowLooper.runPaused(ShadowLooper.java:342)
at org.robolectric.shadows.CoreShadowsAdapter$2.runPaused(CoreShadowsAdapter.java:40)
at org.robolectric.util.ActivityController.create(ActivityController.java:130)
at org.robolectric.util.ActivityController.create(ActivityController.java:140)
at org.robolectric.util.ActivityController.setup(ActivityController.java:234)
at org.robolectric.Robolectric.setupActivity(Robolectric.java:86)
at com.dubizzle.horizontal.activities.MainActivityTest.setUp(MainActivityTest.java:29)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:265)
at org.robolectric.RobolectricTestRunner.runChild(RobolectricTestRunner.java:191)
at org.robolectric.RobolectricTestRunner.runChild(RobolectricTestRunner.java:56)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:157)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

Found 1 deadlock.


Monday, 27 June 2016

Google Maps - Get the center point

Now a day we have apps like Uber or Careem which has a fix point to the center of the map. To get the latitude and longitude of the center of the map, do the follow:

// Get the center of the map and update it as the camera changes
mGoogleMap.setOnCameraChangeListener(new GoogleMap.OnCameraChangeListener() {
    @Override
    public void onCameraChange(CameraPosition cameraPosition) {
        LatLng mapCenterPoint = cameraPosition.target;
        Log.v(TAG, "The center of the map is " + mapCenterPoint);
    }
});

Where mGoogleMap is the type of GoogleMap.

Tuesday, 21 June 2016

Android Alpha Table

In Android the colour could be set using the typical HEX colours, where the first two characters are the Red colour, the next two are the Green colour and the next two are the Blue colour (RGB). Beside this, optionally the user can specify the alpha value, which is the level of transparency of the colour. They are also hexadecimal values, which are attached to the beginning.  Here is the format:

#AARRGGBB

Here is a table of the alpha values used:

100% — FF
  95% — F2
  90% — E6
  85% — D9
  80% — CC
  75% — BF
  70% — B3
  65% — A6
  60% — 99
  55% — 8C
  50% — 80
  45% — 73
  40% — 66
  35% — 59
  30% — 4D
  25% — 40
  20% — 33
  15% — 26
  10% — 1A
    5% — 0D
    0% — 00

Source

More colours

Sunday, 22 May 2016

Enabling logs on HuaWei Devices

It seems that HuaWei devices have disabled the logs by default. To see the logs, you got to do the follow:

1. Open dial app
2. Enter the follow number

*#*#2846579#*#*

There is not need to call. A hidden menu will appear as ProjectMenu


3. Click on Background settings


4. Click on LOG Settings


5. Enable all the logs

Happy debugging!

Source:
StackOverFlow - Huawei, logcat not showing the log for my app?

Monday, 29 February 2016

Git - Undo previous commit and push

If you have commited and pushed a change to the repository and you want to undo those changes, do the follow:
1. Open the terminal
2. Type

git log

This will give you a list of commits, with the text and the hash code
3. Then type

git revert --no-commit HASH_CODE

Where HASH_CODE is the hash code of the specific commit.

The changes will be in stage. All you have to do now is commit and push.