Baseflow / Baseflow/flutter-geolocator

[Bug]: com.google.android.gms.common.api.ApiException: 17: API: LocationServices.API is not available on this device.

Open
#1,786 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
1.3k
Forks
803
Avg merge
8h 16m
Merged PRs (30d)
1

Description

### Please check the following before submitting a new issue.

- [x] I have searched the [existing issues](https://github.com/baseflow/flutter-geolocator/issues).
- [x] I have carefully [read the documentation](https://github.com/Baseflow/flutter-geolocator/blob/main/geolocator/README.md) and verified I have added the required platform specific configuration.

### Please select affected platform(s)

- [x] Android
- [ ] iOS
- [ ] Linux
- [ ] macOS
- [ ] Web
- [ ] Windows

### Steps to reproduce

geolocator: ^9.0.2

1. {"call_stack.info":"com.google.android.gms.tasks.RuntimeExecutionException: com.google.android.gms.common.api.ApiException: 17: API: LocationServices.API is not available on this device. Connection failed with: ConnectionResult{statusCode=API_UNAVAILABLE, resolution=null, message=null}\n\tat com.google.android.gms.tasks.zzw.getResult(com.google.android.gms:play-services-tasks@@18.1.0:3)\n\tat com.baseflow.geolocator.location.FusedLocationClient.lambda$isLocationServiceEnabled$0(FusedLocationClient.java:172)\n\tat com.baseflow.geolocator.location.FusedLocationClient$$ExternalSyntheticLambda0.onComplete(D8$$SyntheticClass:0)\n\tat com.google.android.gms.tasks.zzi.run(com.google.android.gms:play-services-tasks@@18.1.0:1)\n\tat android.os.Handler.handleCallback(Handler.java:938)\n\tat android.os.Handler.dispatchMessage(Handler.java:99)\n\tat android.os.Looper.loopOnce(Looper.java:233)\n\tat android.os.Looper.loop(Looper.java:344)\n\tat android.app.ActivityThread.main(ActivityThread.java:8205)\n\tat java.lang.reflect.Method.invoke(Native Method)\n\tat com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:589)\n\tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1071)\nCaused by: com.google.android.gms.common.api.ApiException: 17: API: LocationServices.API is not available on this device. Connection failed with: ConnectionResult{statusCode=API_UNAVAILABLE, resolution=null, message=null}\n\tat com.google.android.gms.common.internal.ApiExceptionUtil.fromStatus(com.google.android.gms:play-services-base@@18.3.0:3)\n\tat com.google.android.gms.common.api.internal.ApiExceptionMapper.getException(com.google.android.gms:play-services-base@@18.3.0:1)\n\tat com.google.android.gms.common.api.internal.zag.zad(com.google.android.gms:play-services-base@@18.3.0:1)\n\tat com.google.android.gms.common.api.internal.zabq.zaF(com.google.android.gms:play-services-base@@18.3.0:7)\n\tat com.google.android.gms.common.api.internal.zabq.zaE(com.google.android.gms:play-services-base@@18.3.0:2)\n\tat com.google.android.gms.common.api.internal.zabq.zar(com.google.android.gms:play-services-base@@18.3.0:23)\n\tat com.google.android.gms.common.api.internal.zabt.run(com.google.android.gms:play-services-base@@18.3.0:12)\n\tat android.os.Handler.handleCallback(Handler.java:938)\n\tat android.os.Handler.dispatchMessage(Handler.java:99)\n\tat android.os.Looper.loopOnce(Looper.java:233)\n\tat android.os.Looper.loop(Looper.java:344)\n\tat android.os.HandlerThread.run(HandlerThread.java:67)\n","call_stack.thread.name":"main","call_stack.thread.id":2}

### Expected results

fix the crash, thanks.

### Actual results

geolocator: ^9.0.2

### Code sample

Code sample

```dart
[Paste your code here]
```

### Screenshots or video

Screenshots or video demonstration

[Upload media here]

### Version

geolocator: ^9.0.2

### Flutter Doctor output

Doctor output

```console
[Paste your output here]
```

Contributor guide

Open the contributing guide

Research direction

Start at FusedLocationClient.java:172, where isLocationServiceEnabled reaches the Google Play services LocationServices.API call shown in the stack trace. Reproduce the issue on the affected Android device and determine how API_UNAVAILABLE is surfaced. Done means the reported crash is handled or avoided and the relevant Android behavior is covered by an appropriate test.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, dart, flutter, java
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.