ANR Error Updating com.google.android.gms:play-services-location to 21.0.1
Asked Answered
C

2

7

I've recently updated my Android project to Android 33, and I've encountered an issue after updating the dependency com.google.android.gms:play-services-location from version 20.0.0 to 21.0.1. My project compiles without any issue, but when the user opens the lookup phone screen within my app, the screen freezes, and I receive an ANR (Application Not Responding) error.

Here's the relevant portion of my Gradle project app file:

dependencies {
    classpath 'com.android.tools.build:gradle:8.1.0'
    classpath "com.google.gms:google-services:4.3.15"
    classpath "com.google.firebase:firebase-crashlytics-gradle:2.9.8"
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    classpath "com.google.firebase:firebase-appdistribution-gradle:4.0.0"
    classpath "org.jetbrains.kotlin:kotlin-serialization:1.6.0"
    classpath 'com.google.firebase:perf-plugin:1.4.2'
  }

Gradle module app dependencies:

playServiceAuth             : "com.google.android.gms:play-services-auth:20.6.0",
          playServiceApiPhone         : "com.google.android.gms:play-services-auth-api-phone:18.0.1",
          playServiceAnalytics        : "com.google.android.gms:play-services-analytics:18.0.3",
          playServiceBase             : "com.google.android.gms:play-services-base:18.2.0",
          playServiceLocation         : "com.google.android.gms:play-services-location:20.0.0",
          playServiceMaps             : "com.google.android.gms:play-services-maps:18.1.0",

I'm also using firebaseBomVersion 30.5.0.

The error message I'm getting is:

ANR in com.app.android.debug (com.app.android.debug/com.app.android.view.ui.activities.PhoneLookupActivity)
                 PID: 29822
                 Reason: Input dispatching timed out (63037a6 com.app.android.debug/com.app.android.view.ui.activities.PhoneLookupActivity (server) is
                 not responding. Waited 10010ms for FocusEvent(hasFocus=true))
                 Parent: com.app.android.debug/com.app.android.view.ui.activities.PhoneLookupActivity
                 ErrorId: c4a725b2-2ec6-470d-91c9-926796d612d5
                 Frozen: s[false] g[false]

When I revert the dependency back to version 20.0.0, everything works fine again. This issue is specifically related to a text field for inputting a phone number on the lookup phone screen. Previously, this screen would request focus and worked perfectly.

Has anyone encountered this issue or have any insights into what might be causing it? Any help would be greatly appreciated!

Thank you!

Crater answered 21/8, 2023 at 22:21 Comment(3)
Have you managed to solve this?Drislane
No, the issue remains unresolved. I had to resort to using the com.google.android.gms:play-services-location:20.0.0 version for my project and updated the Boom version to 32.2.2. This combination, being the most recent at that time, functioned effectively with my project.Crater
the issue in the latest version of 21.0.1 for me make another issues but all about stability you can use 20.0.0 it is good and more stable #java #androidCristinecristiona
C
1

On new devices I get a stacktrace pointing to the cause of the ANR as com.google.android.gms.internal.location.zzau.getLastLocation(com.google.android.gms:play-services-location@@21.0.1:12)

Which led me to this specific line of code LocationServices.FusedLocationApi.getLastLocation(googleApiClient);

This api is deprecated and it would be nice if deprecated code doesn't cause ANRs, but I think its unlikely to be fixed in future releases.

I updated to the new api for requesting location and the ANR went away.

LocationServices.getFusedLocationProviderClient(context).getLastLocation();

Cracked answered 18/12, 2023 at 1:5 Comment(0)
C
0

the issue in the latest version of 21.0.1 for me make another issues but all about stability you can use 20.0.0 it is good and more stable

implementation 'com.google.android.gms:play-services-location:20.0.0'
implementation 'com.google.android.gms:play-services-analytics:18.0.2'
implementation 'com.google.android.gms:play-services-maps:18.2.0'

#java #android

Cristinecristiona answered 13/11, 2023 at 12:3 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.