I got lots of this on Android 4.0.4 where android.app.ActivityManager.getMyMemoryState
is missing method.
And full stack trace is:
Fatal Exception: java.lang.NoSuchMethodError: android.app.ActivityManager.getMyMemoryState
at com.google.android.gms.common.api.internal.BackgroundDetector.readCurrentStateIfPossible(Unknown Source:17)
at com.google.android.gms.common.api.internal.GoogleApiManager.handleMessage(Unknown Source:169)
at android.os.Handler.dispatchMessage(Handler.java:95)
at com.google.android.gms.internal.base.zap.dispatchMessage(Unknown Source:8)
at android.os.Looper.loop(Looper.java:154)
at android.os.HandlerThread.run(HandlerThread.java:65
My gms related dependencies is:
implementation 'com.google.android.gms:play-services-base:16.1.0'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.android.gms:play-services-games:16.0.0'
+ firebase:
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-perf:16.2.3'
implementation 'com.google.firebase:firebase-ads:17.1.3'
Which seem to be up to date (at time of writing)
Is there anything I can do to prevent those crashes?
I located the source of this issue:
play-services-base:16.1.0
assume it runs on at least JellyBean (API level 16) OS (I found this with help of Android Studio java decompiler (PlatformVersion.isAtLeastJellyBean
just unconditionally return true.)), which, is not true in my case.
So I downgraded to play-services-base:16.1.0
to play-services-base:16.0.1
and crashes was stopped.
Until the problem is not solved by Google, just use and force play-services-basement:16.0.1
implementation "com.google.android.gms:play-services-basement:16.0.1"
configurations.all {
resolutionStrategy.force "com.google.android.gms:play-services-basement:16.0.1"
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With