Skip to content

[google_maps_flutter] Hybrid Composition throw error #105229

@paulVulog

Description

@paulVulog

sum up

This issue is regarding this topic :
https://docs.flutter.dev/development/platform-integration/platform-views

At some point, while playing with the Hybrid Composition you can get some error in the flutter logs.

way to reproduce

    • Be sure to have the AndroidGoogleMapsFlutter.useAndroidViewSurface set to true in the lib/main.dart file.
    • In the lib/map_click.dart file, add a simple Container widget stacked on top of the map.
      E.G : in the Build method, return :
@override
  Widget build(BuildContext context) {
     
     ......
     
     return Stack(
      children: [
        googleMap,
        Center(
          child: Container(
            color: Colors.green,
            width: 100,
            height: 100,
          ),
        )
      ],
    );
}
    • Run the app and open the MapClick section.
      To reproduce the Error in the logs, simply do some Multi touch wit the map and the green container at the same time :
      A digit in the map, the other digit in the green container widget, and tap both at the same time.
    • You will get this kind of logs :
 I/ViewRootImpl@4ffe3aa[FlutterActivity](18949): ViewPostIme pointer 0
E/MethodChannel#flutter/platform_views(18949): Failed to handle method call
E/MethodChannel#flutter/platform_views(18949): java.lang.IllegalArgumentException: pointerIndex out of range
E/MethodChannel#flutter/platform_views(18949): 	at android.view.MotionEvent.nativeGetPointerId(Native Method)
E/MethodChannel#flutter/platform_views(18949): 	at android.view.MotionEvent.getPointerId(MotionEvent.java:2717)
E/MethodChannel#flutter/platform_views(18949): 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:3585)
E/MethodChannel#flutter/platform_views(18949): 	at io.flutter.plugin.platform.PlatformViewsController$1.onTouch(PlatformViewsController.java:313)
E/MethodChannel#flutter/platform_views(18949): 	at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.touch(PlatformViewsChannel.java:176)
E/MethodChannel#flutter/platform_views(18949): 	at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:68)
E/MethodChannel#flutter/platform_views(18949): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
E/MethodChannel#flutter/platform_views(18949): 	at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:296)
E/MethodChannel#flutter/platform_views(18949): 	at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$DartMessenger(DartMessenger.java:320)
E/MethodChannel#flutter/platform_views(18949): 	at io.flutter.embedding.engine.dart.-$$Lambda$DartMessenger$AIEPqY6mWzaNK15HekX9bftoAXs.run(Unknown Source:12)
E/MethodChannel#flutter/platform_views(18949): 	at android.os.Handler.handleCallback(Handler.java:883)
E/MethodChannel#flutter/platform_views(18949): 	at android.os.Handler.dispatchMessage(Handler.java:100)
E/MethodChannel#flutter/platform_views(18949): 	at android.os.Looper.loop(Looper.java:237)
E/MethodChannel#flutter/platform_views(18949): 	at android.app.ActivityThread.main(ActivityThread.java:8167)
E/MethodChannel#flutter/platform_views(18949): 	at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#flutter/platform_views(18949): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
E/MethodChannel#flutter/platform_views(18949): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
I/ViewRootImpl@4ffe3aa[FlutterActivity](18949): ViewPostIme pointer 1
E/flutter (18949): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: PlatformException(error, pointerIndex out of range, null, java.lang.IllegalArgumentException: pointerIndex out of range
E/flutter (18949): 	at android.view.MotionEvent.nativeGetPointerId(Native Method)
E/flutter (18949): 	at android.view.MotionEvent.getPointerId(MotionEvent.java:2717)
E/flutter (18949): 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:3585)
E/flutter (18949): 	at io.flutter.plugin.platform.PlatformViewsController$1.onTouch(PlatformViewsController.java:313)
E/flutter (18949): 	at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.touch(PlatformViewsChannel.java:176)
E/flutter (18949): 	at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:68)
E/flutter (18949): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
E/flutter (18949): 	at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:296)
E/flutter (18949): 	at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$DartMessenger(DartMessenger.java:320)
E/flutter (18949): 	at io.flutter.embedding.engine.dart.-$$Lambda$DartMessenger$AIEPqY6mWzaNK15HekX9bftoAXs.run(Unknown Source:12)
E/flutter (18949): 	at android.os.Handler.handleCallback(Handler.java:883)
E/flutter (18949): 	at android.os.Handler.dispatchMessage(Handler.java:100)
E/flutter (18949): 	at android.os.Looper.loop(Looper.java:237)
E/flutter (18949): 	at android.app.ActivityThread.main(ActivityThread.java:8167)
E/flutter (18949): 	at java.lang.reflect.Method.invoke(Native Method)
E/flutter (18949): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
E/flutter (18949): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
E/flutter (18949): )
E/flutter (18949): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:607:7)
E/flutter (18949): #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:177:18)
E/flutter (18949): <asynchronous suspension>
E/flutter (18949): #2      AndroidViewController.sendMotionEvent (package:flutter/src/services/platform_views.dart:803:5)
E/flutter (18949): <asynchronous suspension>
E/flutter (18949): #3      AndroidViewController.dispatchPointerEvent (package:flutter/src/services/platform_views.dart:895:7)
E/flutter (18949): <asynchronous suspension>
E/flutter (18949):  

This only occurs with AndroidGoogleMapsFlutter.useAndroidViewSurface = true.
Using Mapbox, this can even cause the app to crash.
I suspect flutter to get some issue with the multitouch will tapping a native view (the map) and a flutter widget (the container) at the same time.

external links

Here is the tracked issue for Mapbox :
flutter-mapbox-gl/maps#1077

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectc: crashStack traces logged to the consolefound in release: 3.0Found to occur in 3.0found in release: 3.1Found to occur in 3.1has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: mapsGoogle Maps pluginpackageflutter/packages repository. See also p: labels.platform-androidAndroid applications specifically

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions