在设备上启动Android应用程序时随机黑屏

时间:2014-12-12 16:21:54

标签: android google-analytics crash android-logcat

当我将我的应用程序从Android工作室启动到设备或当我从直接APK文件下载并安装它时,有时会出现黑屏,几秒钟后会出现应用程序崩溃的提示消息。

除了:

之外,logcat中没有关于此的信息
  

将堆栈跟踪写入'/data/anr/traces.txt'

所以我打开了这个文件,但我不明白我应该在里面搜索它!

也许这些行:

----- 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)

也许我错了,但这些崩溃可能来自谷歌分析?

这些随机崩溃的任何帮助?

谢谢;)

2 个答案:

答案 0 :(得分:5)

这里的问题相同。我刚刚更新了Google Play服务,我正在使用:

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'

我反编译代码,看起来GoogleAnalytics.getInstance()GoogleAnalytics.class实例上同步,还有两个异步线程使用另一个同步的getter static GoogleAnalytics eY()。我无法弄清楚发生了什么(代码被混淆了),但我想这是库中的一个问题。

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)

修改 这里也报告了这个问题:https://code.google.com/p/android/issues/detail?id=82157。 从清单中删除全局配置解决了我的问题。

答案 1 :(得分:0)

我修复了此问题,但将关闭我正在发送的Google Analytics。

在我们的项目中,我们使用boolean值:

boolean isDeveloperMode = true; // Don't send unless it's a public build

修正了问题:)