Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Random black screen when launching android app on device

When i launch my app from Android studio to device or when i download and install it from direct APK file, sometimes there is a black screen and after some seconds, there is a prompt with app crash message.

There is no informations about that in the logcat except :

Wrote stack traces to '/data/anr/traces.txt'

So i opened this file but i don't understand what i'm supposed to search inside it !

Maybe theses lines :

----- pid 28645 at 2014-12-12 14:44:02 -----
Cmd line: fr.myapp.www.myapp

DALVIK THREADS:
(mutexes: tll=0 tsl=0 tscl=0 ghl=0)

"main" prio=5 tid=1 MONITOR
  | group="main" sCount=1 dsCount=0 obj=0x4109b9a0 self=0x4108a450
  | sysTid=28645 nice=-11 sched=0/0 cgrp=[fopen-error:2] handle=1074673116
  | state=S schedstat=( 0 0 0 ) utm=4 stm=2 core=1
  at com.google.android.gms.analytics.ae.getLogger((null):~-1)
  - waiting to lock <0x41686d38>  held by tid=13 (client_id_fetcher)
  at com.google.android.gms.analytics.ae.W((null):-1)
  at com.google.android.gms.analytics.z$a.f((null):-1)
  at com.google.android.gms.analytics.n.a((null):-1)
  at com.google.android.gms.analytics.n.x((null):-1)
  at com.google.android.gms.analytics.GoogleAnalytics.eZ((null):-1)
  at com.google.android.gms.analytics.GoogleAnalytics.<init>((null):-1)
  at com.google.android.gms.analytics.GoogleAnalytics.<init>((null):-1)
  at com.google.android.gms.analytics.GoogleAnalytics.getInstance((null):-1)
  at fr.myapp.www.myapp.MyAppApplication.getTracker(MyAppApplication.java:36)
  at fr.myapp.www.myapp.DashboardActivity.onCreate(DashboardActivity.java:41)
  at android.app.Activity.performCreate(Activity.java:5326)
  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1097)
  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2225)
  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2316)
  at android.app.ActivityThread.access$700(ActivityThread.java:158)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1296)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:176)
  at android.app.ActivityThread.main(ActivityThread.java:5365)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:511)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
  at dalvik.system.NativeStart.main(Native Method)

Maybe i'm wrong but these crashes can come from Google Analytics ?

Any help with these random crashes ?

Thanks ;)

like image 400
Benjamin B. Avatar asked Dec 12 '14 16:12

Benjamin B.


1 Answers

Same issue here. I just updated Google Play Services and I'm using:

compile 'com.google.android.gms:play-services-base:6.5.87'
compile 'com.google.android.gms:play-services-plus:6.5.87'
compile 'com.google.android.gms:play-services-ads:6.5.87'

I decompiled the code and it looks like GoogleAnalytics.getInstance() is synchronized on GoogleAnalytics.class instance and there are two more async threads that uses another getter static GoogleAnalytics eY() which also synchronized. I can't really figure out whats going on (the code is obfuscated), but I guess it's an issue in the library.

DALVIK THREADS (15): 
"main" prio=5 tid=1 Blocked
  | group="main" sCount=1 dsCount=0 obj=0x735b82e0 self=0xb8e08530
  | sysTid=7921 nice=0 cgrp=apps sched=0/0 handle=0xb6f0bec8
  | state=S schedstat=( 0 0 0 ) utm=3 stm=3 core=2 HZ=100
  | stack=0xbe590000-0xbe592000 stackSize=8MB
  | held mutexes=
  at com.google.android.gms.analytics.ae.getLogger(unavailable:-1)
  - waiting to lock <0x1c19179f> (a java.lang.Class<com.google.android.gms.analytics.ae>) held by thread 15
  at com.google.android.gms.analytics.ae.V(unavailable:-1)
  at com.google.android.gms.analytics.GoogleAnalytics.a(unavailable:-1)
  at com.google.android.gms.analytics.GoogleAnalytics.eZ(unavailable:-1)
  at com.google.android.gms.analytics.GoogleAnalytics.<init>(unavailable:-1)
  at com.google.android.gms.analytics.GoogleAnalytics.<init>(unavailable:-1)
  at com.google.android.gms.analytics.GoogleAnalytics.getInstance(unavailable:-1)
  - locked <0x3fdbb0ec> (a java.lang.Class<com.google.android.gms.analytics.GoogleAnalytics>)
  ... my application logic
  at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1011)
  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4518)
  at android.app.ActivityThread.access$1500(ActivityThread.java:144)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1339)
  at android.os.Handler.dispatchMessage(Handler.java:102)
  at android.os.Looper.loop(Looper.java:135)
  at android.app.ActivityThread.main(ActivityThread.java:5221)
  at java.lang.reflect.Method.invoke!(Native method)
  at java.lang.reflect.Method.invoke(Method.java:372)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

... other threads

"GAThread" prio=5 tid=14 Blocked
  | group="main" sCount=1 dsCount=0 obj=0x12c8e680 self=0xb90b8f50
  | sysTid=7942 nice=10 cgrp=apps/bg_non_interactive sched=0/0 handle=0xb90b9590
  | state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=0 HZ=100
  | stack=0xa3f4d000-0xa3f4f000 stackSize=1036KB
  | held mutexes=
  at com.google.android.gms.analytics.GoogleAnalytics.getInstance(unavailable:-1)
  - waiting to lock <0x3fdbb0ec> (a java.lang.Class<com.google.android.gms.analytics.GoogleAnalytics>) held by thread 1
  at com.google.android.gms.analytics.w.<init>(unavailable:-1)
  at com.google.android.gms.analytics.x.init(unavailable:-1)
  - locked <@addr=0x12c8e680> (a com.google.android.gms.analytics.x)
  at com.google.android.gms.analytics.x.run(unavailable:-1)

"client_id_fetcher" prio=5 tid=15 Blocked
  | group="main" sCount=1 dsCount=0 obj=0x12c24ec0 self=0xb90b9b70
  | sysTid=7943 nice=0 cgrp=apps sched=0/0 handle=0xb90ba1b0
  | state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=0 HZ=100
  | stack=0xa3e43000-0xa3e45000 stackSize=1036KB
  | held mutexes=
  at com.google.android.gms.analytics.GoogleAnalytics.eY(unavailable:-1)
  - waiting to lock <0x3fdbb0ec> (a java.lang.Class<com.google.android.gms.analytics.GoogleAnalytics>) held by thread 1
  at com.google.android.gms.analytics.ae.getLogger(unavailable:-1)
  - locked <0x1c19179f> (a java.lang.Class<com.google.android.gms.analytics.ae>)
  at com.google.android.gms.analytics.ae.V(unavailable:-1)
  at com.google.android.gms.analytics.k.eq(unavailable:-1)
  at com.google.android.gms.analytics.k$1.run(unavailable:-1)
  - locked <@addr=0x12d3d110> (a java.lang.Object)

EDIT: The issue is reported here as well: https://code.google.com/p/android/issues/detail?id=82157. Removing the global config from the manifest resolved the issue for me.

like image 56
Gyufa Avatar answered Sep 30 '22 04:09

Gyufa