Upgraded an app in development to 9.0.0 with these changes and a regeneration of google-services.json
:
classpath 'com.google.gms:google-services:3.0.0'
compile 'com.google.android.gms:play-services:9.0.0'
After upgrade, when the app initializes, the expected sequence of logcat messages appear. After about 7 seconds, the same sequence of messages is output again, with added header background_crash
. For example:
17:39:30.162 5453-5453/com.xxx.nub:background_crash I/MultiDex: install done
The app operates normally until it becomes hidden, for example by starting an activity in another app. After 5 seconds the system detects that the app is hung:
05-20 17:40:10.315 5138-5138/com.xxx.nub I/MainActivity: STOP MainActivity
05-20 17:40:10.375 5138-5138/com.xxx.nub I/NubApplication: onTrimMemory(): TRIM_MEMORY_UI_HIDDEN
05-20 17:40:10.375 5138-5138/com.xxx.nub D/FirebaseApp: Notifying background state change listeners.
05-20 17:45:10.465 5138-5143/com.xxx.nub I/dalvikvm: threadid=3: reacting to signal 3
05-20 17:45:10.565 5138-5143/com.xxx.nub I/dalvikvm: Wrote stack traces to '/data/anr/traces.txt'
The stack trace shows the app is hung in com.google.android.gms.DynamiteModulesC
----- pid 5138 at 2016-05-20 17:45:10 -----
Cmd line: com.xxx.nub
JNI: CheckJNI is off; workarounds are off; pins=0; globals=295
DALVIK THREADS:
(mutexes: tll=0 tsl=0 tscl=0 ghl=0)
"main" prio=5 tid=1 WAIT
| group="main" sCount=1 dsCount=0 obj=0x416c5ea0 self=0x415bb5d0
| sysTid=5138 nice=-11 sched=0/0 cgrp=apps handle=1073844564
| state=S schedstat=( 0 0 0 ) utm=1774 stm=244 core=1
at java.lang.Object.wait(Native Method)
- waiting on <0x42804a68> (a aaf)
at java.lang.Object.wait(Object.java:364)
at aaf.a(:com.google.android.gms.DynamiteModulesC:75)
at zq.onTrimMemory(:com.google.android.gms.DynamiteModulesC:1187)
at android.app.Application.onTrimMemory(Application.java:148)
at com.xxx.nub.NubApplication.onTrimMemory(NubApplication.java:211)
at android.app.ActivityThread.handleTrimMemory(ActivityThread.java:4298)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1481)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5487)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
The problem occurs on a phone running KitKat. The problem does not occur on a phone running Lollipop.
The complete logcat
output can be viewed here.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…