java.lang.IncompatibleClassChangeError: Found interface com.google.android.gms.location.SettingsClient, [closed]
Asked Answered
R

3

12

I can't run the app on the emulator or on a real device. When I try to run the app from VS Code, it shows this error message:

screenshot of debug console

I tried uninstalling the app and doing flutter clean.

Rhaetia answered 29/1, 2023 at 9:21 Comment(2)
Did you tried to clear data of the emulator and then try to run?Torp
actually I didn't find specific block of code where issues comes from.Rhaetia
N
15

This error just happened to me when I launched the app in the store. I'm correcting it now, change the Location library to Gelocator.

At first I thought it was an error in Flutter 3.7.0, I lowered the version to 3.3.10 and 3.3.9 and the same problem continued. My solution was to change the location library to geolocator. It has almost the same functions, I only had to make a few changes.

https://pub.dev/packages/geolocator

Nonrestrictive answered 29/1, 2023 at 15:46 Comment(12)
yeah also just started getting this today. Mine is from a flutter app when trying to use location servicesKatowice
This error just happened to me when I launched the app in the store. I'm correcting it now, change the Location library to Gelocator. pub.dev/packages/geolocatorNonrestrictive
Same issue. Any solution? If I downgrade location library version will it help?Elouise
At first I thought it was an error in Flutter 3.7.0, I lowered the version to 3.3.10 and 3.3.9 and the same problem continued. My solution was to change the location library to geolocator. It has almost the same functions, I only had to make a few changes.Nonrestrictive
Removing the location library also solved my problem.Dieldrin
you are right. i change package and issues are goneRhaetia
How are you requesting the GPS Service? I cannot find any alternative other than the location package.Strohl
@Strohl Do you mean to raise the gps service? ask you to activate your location?Nonrestrictive
Could you please help any alternative for Native android application? Because this solution did not work for me in native android app.Silken
Faced the same error after using location: ^4.4.0 and geolocator: ^10.1.0, in same project, but after updating to location: ^5.0.3 geolocator: ^10.1.0 error fixedVerticillate
No need to change the location library to a geolocator. This issue has been fixed in the location library itself just upgrade the library to version 5.0.0 or above.Benefaction
What was the cause anyway? Just changing the package that fixes the problem is good enough, but knowing the issue itself would be much better.Chanukah
S
60

No need to change the package I was also facing this issue I just fixed it:

  1. Go into C:\Users\Qc\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\location-4.4.0\android\build.gradle : changed "com.google.android.gms:play-services-location:16.+" to "com.google.android.gms:play-services-location:21.0.1" works

    dependencies { api '"com.google.android.gms:play-services-location:21.0.1' implementation "androidx.core:core-ktx:1.3.2" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" }

  2. List item In project at android level go into build.gradle and add this line: enter image description here

Update: added the required code

  configurations.all{
      resolutionStrategy{
         force "com.google.android.gms:play-services-location:21.0.1"
      }
 }
Sogdian answered 16/2, 2023 at 8:22 Comment(10)
I only needed to do step 2 - adding the section to the build.gradle fileUt
For mine also the 2 step is helpful. ThanksSnide
For Macbook packages folder address for your Flutter project will be like following: flutter/.pub-cache/hosted/pub.dartlang.org/location-4.3.0/Callahan
number 2 is the one!Lustral
Thank you guys, step 2 was sufficient ❤️Arbitress
Just to mention where the Build.gradle is located. It is in: project/android/build.gradleAnnotation
Thanks! Number 2 made it. The issue was caused by using background_locator and geolocator together on a flutter projectDeth
Thank you so much you saved my life. the step2 worked for me. it worked for RN project.Spray
Thank you so much you saved me. the step2 worked for me. it worked for RN project. –Vshaped
This issue has been fixed in the location 5.0.0 version. Just try to upgrade your location library version 5.0.0 or above to resolve this issue.Benefaction
N
15

This error just happened to me when I launched the app in the store. I'm correcting it now, change the Location library to Gelocator.

At first I thought it was an error in Flutter 3.7.0, I lowered the version to 3.3.10 and 3.3.9 and the same problem continued. My solution was to change the location library to geolocator. It has almost the same functions, I only had to make a few changes.

https://pub.dev/packages/geolocator

Nonrestrictive answered 29/1, 2023 at 15:46 Comment(12)
yeah also just started getting this today. Mine is from a flutter app when trying to use location servicesKatowice
This error just happened to me when I launched the app in the store. I'm correcting it now, change the Location library to Gelocator. pub.dev/packages/geolocatorNonrestrictive
Same issue. Any solution? If I downgrade location library version will it help?Elouise
At first I thought it was an error in Flutter 3.7.0, I lowered the version to 3.3.10 and 3.3.9 and the same problem continued. My solution was to change the location library to geolocator. It has almost the same functions, I only had to make a few changes.Nonrestrictive
Removing the location library also solved my problem.Dieldrin
you are right. i change package and issues are goneRhaetia
How are you requesting the GPS Service? I cannot find any alternative other than the location package.Strohl
@Strohl Do you mean to raise the gps service? ask you to activate your location?Nonrestrictive
Could you please help any alternative for Native android application? Because this solution did not work for me in native android app.Silken
Faced the same error after using location: ^4.4.0 and geolocator: ^10.1.0, in same project, but after updating to location: ^5.0.3 geolocator: ^10.1.0 error fixedVerticillate
No need to change the location library to a geolocator. This issue has been fixed in the location library itself just upgrade the library to version 5.0.0 or above.Benefaction
What was the cause anyway? Just changing the package that fixes the problem is good enough, but knowing the issue itself would be much better.Chanukah
W
-4

in my case, got to C:\Users\Md Emarat Hossain\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\location-4.4.0\android\build.gradle and changed "com.google.android.gms:play-services-location:16.+" to "com.google.android.gms:play-services-location:21.0.1" works

Wordsmith answered 2/2, 2023 at 8:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.