skip to Main Content

java.lang.IncompatibleClassChangeError: Found interface com.google.android.gms.location.SettingsClient, but class was expected (declaration of ‘com.google.android.gms.location.SettingsClient’ appears in /data/app/~~vK3x6kuSR8MsWIHWo0p-pg==/com.wst.occser-5pgr4NMzu9vj5rO5C1Dcew==/base.apk!classes3.dex)
E/AndroidRuntime(15597): at com.lyokone.location.FlutterLocation.startRequestingLocation(FlutterLocation.java:422)
E/AndroidRuntime(15597): at com.lyokone.location.FlutterLocation.onRequestPermissionsResultHandler(FlutterLocation.java:131)
E/AndroidRuntime(15597): at com.lyokone.location.FlutterLocation.onRequestPermissionsResult(FlutterLocation.java:122)
E/AndroidRuntime(15597): at io.flutter.embedding.engine.FlutterEngineConnectionRegistry$FlutterEngineActivityPluginBinding.onRequestPermissionsResult(FlutterEngineConnectionRegistry.java:777)
E/AndroidRuntime(15597): at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.onRequestPermissionsResult(FlutterEngineConnectionRegistry.java:409)
E/AndroidRuntime(15597): at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onRequestPermissionsResult(FlutterActivityAndFragmentDelegate.java:757)
E/AndroidRuntime(15597): at io.flutter.embedding.android.FlutterFragment.onRequestPermissionsResult(FlutterFragment.java:915)
E/AndroidRuntime(15597): at io.flutter.embedding.android.FlutterFragmentActivity.onRequestPermissionsResult(FlutterFragmentActivity.java:549)
E/AndroidRuntime(15597): at android.app.Activity.dispatchRequestPermissionsResult(Activity.java:8619)
E/AndroidRuntime(15597): at android.app.Activity.dispatchActivityResult(Activity.java:8476)
E/AndroidRuntime(15597): at android.app.ActivityThread.deliverResults(ActivityThread.java:5560)
E/AndroidRuntime(15597): at android.app.ActivityThread.handleSendResult(ActivityThread.java:5606)
E/AndroidRuntime(15597): at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:54)
E/AndroidRuntime(15597): at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
E/AndroidRuntime(15597): at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
E/AndroidRuntime(15597): at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
E/AndroidRuntime(15597): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2374)
E/AndroidRuntime(15597): at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime(15597): at android.os.Looper.loopOnce(Looper.java:233)
E/AndroidRuntime(15597): at android.os.Looper.loop(Looper.java:344)
E/AndroidRuntime(15597): at android.app.ActivityThread.main(ActivityThread.java:8248)
E/AndroidRuntime(15597): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(15597): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:589)
E/AndroidRuntime(15597): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1071)
E/Parcel (15597): Reading a NULL string not supported here.
I/Quality (15597): SlowBinder: com.wst.occser to android.app.IActivityManager cost= 284 code= 7
I/Process (15597): Sending signal. PID: 15597 SIG: 9

Using Android 13 device, location plugin ^4.4.0, firebase_messaging ^14.1.2

3

Answers


  1. This issue originates from the location plugin which is referencing an older version of the google play services plugin.

    To solve this issue, you need to update the version of "com.google.android.gms:play-services-location" inside the location package

    How to locate location version

    Change the dependency
    from "api ‘com.google.android.gms:play-services-location:16+’"

    to "api ‘com.google.android.gms:play-services-location:21.0.1’"

    Finally, save and rebuild project

    Login or Signup to reply.
  2. You need to manually edit Android/build.gradle file inside local copy of location package. Packages are hosted inside pub cache folder. Full path to the folder: flutter/.pub-cache/hosted/pub.dartlang.org/location-4.3.0/

    Replace this line:

    api ‘com.google.android.gms:play-services-location:16.+’

    With this:

    api ‘com.google.android.gms:play-services-location:21.0.1’

    Note: You may have multiple versions of that package there. You need to find out which one your project is currently using and edit that one.

    Login or Signup to reply.
  3. add this line to your android/app/build.gradle:

    implementation 'com.google.android.gms:play-services-location:20.0.0'
    

    and rerun the app.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search