Flutter App crashing on Android using Google Maps Flutter Plugin

Viewed 2825

I'm trying to set up googles map plugin for flutter folloing the Readme docs in pub.dev of the package google_maps_flutter 1.0.6 https://pub.dev/packages/google_maps_flutter . However the app keep crashing on Android, works fine on iOS.

Here is the output from Console:

Running Gradle task 'assembleDebug'...
āœ“ Built build/app/outputs/flutter-apk/app-debug.apk.
Installing build/app/outputs/flutter-apk/app.apk...
Debug service listening on ws://127.0.0.1:58755/ub1_3ODfGto=/ws
Syncing files to device sdk gphone x86 arm...
I/FirebaseApp(16117): Device unlocked: initializing all Firebase APIs for app db2
I/zzbz    (16117): Making Creator dynamically
I/DynamiteModule(16117): Considering local module com.google.android.gms.maps_dynamite:0 and remote module com.google.android.gms.maps_dynamite:201817000
I/DynamiteModule(16117): Selected remote version of com.google.android.gms.maps_dynamite, version >= 201817000
V/DynamiteModule(16117): Dynamite loader version >= 2, using loadModule2NoCrashUtils
W/Gralloc4(16117): allocator 3.x is not supported
W/sharp.seeeA(16117): Unsupported class loader
W/sharp.seeeA(16117): Unsupported class loader
I/Google Maps Android API(16117): Google Play services client version: 12451000
I/Google Maps Android API(16117): Google Play services package version: 201817022
E/AndroidRuntime(16117): FATAL EXCEPTION: main
E/AndroidRuntime(16117): Process: net.visualsharp.cab_rider, PID: 16117
E/AndroidRuntime(16117): java.lang.AbstractMethodError: abstract method "void io.flutter.plugin.platform.PlatformView.onFlutterViewAttached(android.view.View)"
E/AndroidRuntime(16117):    at io.flutter.plugin.platform.VirtualDisplayController.onFlutterViewAttached(VirtualDisplayController.java:181)
E/AndroidRuntime(16117):    at io.flutter.plugin.platform.PlatformViewsController$1.createVirtualDisplayForPlatformView(PlatformViewsController.java:233)
E/AndroidRuntime(16117):    at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:104)
E/AndroidRuntime(16117):    at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:59)
E/AndroidRuntime(16117):    at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/AndroidRuntime(16117):    at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/AndroidRuntime(16117):    at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:738)
E/AndroidRuntime(16117):    at android.os.MessageQueue.nativePollOnce(Native Method)
E/AndroidRuntime(16117):    at android.os.MessageQueue.next(MessageQueue.java:335)
E/AndroidRuntime(16117):    at android.os.Looper.loop(Looper.java:183)
E/AndroidRuntime(16117):    at android.app.ActivityThread.main(ActivityThread.java:7656)
E/AndroidRuntime(16117):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(16117):    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/AndroidRuntime(16117):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
I/Process (16117): Sending signal. PID: 16117 SIG: 9
Lost connection to device.
2 Answers

Add android.enableDexingArtifactTransform=false to gradle.properties.

The issue and this solution on GitHub.

Bumping the minSdkVersion from 16 to 24 in .../android/app/build.gradle fixes the issue.

Related