Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AndroidView Exception #29294

Closed
LinXiaoTao opened this issue Mar 13, 2019 · 14 comments
Closed

AndroidView Exception #29294

LinXiaoTao opened this issue Mar 13, 2019 · 14 comments
Labels
a: platform-views Embedding Android/iOS views in Flutter apps c: crash Stack traces logged to the console f: gestures flutter/packages/flutter/gestures repository. framework flutter/packages/flutter repository. See also f: labels. platform-android Android applications specifically

Comments

@LinXiaoTao
Copy link
Contributor

Steps to Reproduce

I used AndroidView to call the native map component, which happens when I use a three-finger drag.

Logs

I/flutter (21291): Another exception was thrown: 'package:flutter/src/services/platform_views.dart': Failed assertion: line 284 pos 15: 'downTime != null': is not true.
E/flutter (21291): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: NoSuchMethodError: The method '_asList' was called on null.
E/flutter (21291): Receiver: null
E/flutter (21291): Tried calling: _asList()
E/flutter (21291): #0      Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:50:5)
E/flutter (21291): #1      AndroidMotionEvent._asList.<anonymous closure> (package:flutter/src/services/platform_views.dart:372:74)
E/flutter (21291): #2      MappedListIterable.elementAt (dart:_internal/iterable.dart:414:29)
E/flutter (21291): #3      ListIterable.toList (dart:_internal/iterable.dart:219:19)
E/flutter (21291): #4      AndroidMotionEvent._asList (package:flutter/src/services/platform_views.dart:372:85)
E/flutter (21291): #5      AndroidViewController.sendMotionEvent (package:flutter/src/services/platform_views.dart:555:15)
E/flutter (21291): <asynchronous suspension>
E/flutter (21291): #6      _MotionEventsDispatcher.dispatchPointerEvent (package:flutter/src/rendering/platform_view.dart:615:20)
E/flutter (21291): #7      _MotionEventsDispatcher.handlePointerEvent (package:flutter/src/rendering/platform_view.dart:543:5)
E/flutter (21291): #8      List.forEach (dart:core/runtime/libgrowable_array.dart:278:8)
E/flutter (21291): #9      _AndroidViewGestureRecognizer.flushPointerCache (package:flutter/src/rendering/platform_view.dart:502:35)
E/flutter (21291): #10     _AndroidViewGestureRecognizer.acceptGesture (package:flutter/src/rendering/platform_view.dart:484:5)
E/flutter (21291): #11     _CombiningGestureArenaMember.acceptGesture (package:flutter/src/gestures/team.dart:41:13)
E/flutter (21291): #12     GestureArenaManager._resolveByDefault (package:flutter/src/gestures/arena.dart:250:25)
E/flutter (21291): #13     GestureArenaManager._tryToResolveArena.<anonymous closure> (package:flutter/src/gestures/arena.dart:231:31)
E/flutter (21291): #14     _rootRun (dart:async/zone.dart:1120:38)
E/flutter (21291): #15     _CustomZone.run (dart:async/zone.dart:1021:19)
E/flutter (21291): #16     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
E/flutter (21291): #17     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
E/flutter (21291): #18     _rootRun (dart:async/zone.dart:1124:13)
E/flutter (21291): #19     _CustomZone.run (dart:async/zone.dart:1021:19)
E/flutter (21291): #20     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
E/flutter (21291): #21     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
E/flutter (21291): #22     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
E/flutter (21291): #23     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
E/flutter (21291): 
E/flutter (21291): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: NoSuchMethodError: The method '_asList' was called on null.
E/flutter (21291): Receiver: null
E/flutter (21291): Tried calling: _asList()
E/flutter (21291): #0      Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:50:5)
E/flutter (21291): #1      AndroidMotionEvent._asList.<anonymous closure> (package:flutter/src/services/platform_views.dart:372:74)
E/flutter (21291): #2      MappedListIterable.elementAt (dart:_internal/iterable.dart:414:29)
E/flutter (21291): #3      ListIterable.toList (dart:_internal/iterable.dart:219:19)
E/flutter (21291): #4      AndroidMotionEvent._asList (package:flutter/src/services/platform_views.dart:372:85)
E/flutter (21291): #5      AndroidViewController.sendMotionEvent (package:flutter/src/services/platform_views.dart:555:15)
E/flutter (21291): <asynchronous suspension>
E/flutter (21291): #6      _MotionEventsDispatcher.dispatchPointerEvent (package:flutter/src/rendering/platform_view.dart:615:20)
E/flutter (21291): #7      _MotionEventsDispatcher.handlePointerEvent (package:flutter/src/rendering/platform_view.dart:543:5)
E/flutter (21291): #8      List.forEach (dart:core/runtime/libgrowable_array.dart:278:8)
E/flutter (21291): #9      _AndroidViewGestureRecognizer.flushPointerCache (package:flutter/src/rendering/platform_view.dart:502:35)
E/flutter (21291): #10     _AndroidViewGestureRecognizer.acceptGesture (package:flutter/src/rendering/platform_view.dart:484:5)
E/flutter (21291): #11     _CombiningGestureArenaMember.acceptGesture (package:flutter/src/gestures/team.dart:41:13)
E/flutter (21291): #12     GestureArenaManager._resolveByDefault (package:flutter/src/gestures/arena.dart:250:25)
E/flutter (21291): #13     GestureArenaManager._tryToResolveArena.<anonymous closure> (package:flutter/src/gestures/arena.dart:231:31)
E/flutter (21291): #14     _rootRun (dart:async/zone.dart:1120:38)
E/flutter (21291): #15     _CustomZone.run (dart:async/zone.dart:1021:19)
E/flutter (21291): #16     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
E/flutter (21291): #17     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
E/flutter (21291): #18     _rootRun (dart:async/zone.dart:1124:13)
E/flutter (21291): #19     _CustomZone.run (dart:async/zone.dart:1021:19)
E/flutter (21291): #20     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
E/flutter (21291): #21     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
E/flutter (21291): #22     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
E/flutter (21291): #23     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
E/flutter (21291): 
[✓] Flutter (Channel stable, v1.2.1, on Mac OS X 10.14.2 18C54, locale
    zh-Hans-CN)
    • Flutter version 1.2.1 at /Users/leo/Documents/flutter
    • Framework revision 8661d8aecd (4 weeks ago), 2019-02-14 19:19:53 -0800
    • Engine revision 3757390fa4
    • Dart version 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/leo/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling
      support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_152-release-1248-b01)
    • All Android licenses accepted.

[✗] iOS toolchain - develop for iOS devices
    ✗ Xcode installation is incomplete; a full installation is necessary for iOS
      development.
      Download at: https://developer.apple.com/xcode/download/
      Or install Xcode via the App Store.
      Once installed, run:
        sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
    ✗ libimobiledevice and ideviceinstaller are not installed. To install with
      Brew, run:
        brew update
        brew install --HEAD usbmuxd
        brew link usbmuxd
        brew install --HEAD libimobiledevice
        brew install ideviceinstaller
    ✗ ios-deploy not installed. To install:
        brew install ios-deploy
    ✗ CocoaPods not installed.
        CocoaPods is used to retrieve the iOS platform side's plugin code that
        responds to your plugin usage on the Dart side.
        Without resolving iOS dependencies with CocoaPods, plugins will not work
        on iOS.
        For more info, see https://flutter.io/platform-plugins
      To install:
        brew install cocoapods
        pod setup

[✓] Android Studio (version 3.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 32.0.1
    • Dart plugin version 182.5215
    • Java version OpenJDK Runtime Environment (build
      1.8.0_152-release-1248-b01)

[!] IntelliJ IDEA Community Edition (version 2018.3.3)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • For information about installing plugins, see
      https://flutter.io/intellij-setup/#installing-the-plugins

[✓] VS Code (version 1.31.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 2.24.0

[✓] Connected device (1 available)
    • vivo X21A • abe5dc7b • android-arm64 • Android 8.1.0 (API 27)

! Doctor found issues in 2 categories.
@escamoteur
Copy link
Contributor

Hi, could you please confirm if this problem still exists with the latest versions on stable or master?

Thanks a lot

@escamoteur escamoteur added a: platform-views Embedding Android/iOS views in Flutter apps c: crash Stack traces logged to the console waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds platform-android Android applications specifically labels Sep 24, 2019
@duzenko

This comment has been minimized.

@escamoteur
Copy link
Contributor

@duzenko What do you need to to to get that error? Also three finger drag?

@escamoteur escamoteur added f: gestures flutter/packages/flutter/gestures repository. and removed waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds labels Oct 23, 2019
@escamoteur escamoteur added this to the Goals milestone Oct 23, 2019
@duzenko

This comment has been minimized.

@Diaglyonok
Copy link

Diaglyonok commented Oct 30, 2019

@duzenko What do you need to to to get that error? Also three finger drag?

I make screenshot in Xiaomi device (while google map module is opened). (swipe down with 3 fingers). These gestures always throw such exception.
Before exception there is such message in logs:
D/ViewRootImpl(22189): cancle motionEvent because of threeGesture detecting

@chenzongwen
Copy link

Is there a better way to solve the problem so far.

@iapicca iapicca added the framework flutter/packages/flutter repository. See also f: labels. label Jan 14, 2020
@Bee777
Copy link

Bee777 commented Jan 17, 2020

Same issue as above LOG with latest version of flutter stable channel and latest version of google_maps_flutter package.

Take a look at #20517 solved the problem with a workaround, modify the file packages/flutter/lib/src/rendering/platform_view.dart

@singun-lxd
Copy link

Same issue with Flutter v1.12.13+hotfix8, stack trace is:

1 #0 AndroidMotionEvent._asList.<anonymous closure> (package:flutter/src/services/platform_views.dart:408)
2 #1 MappedListIterable.elementAt (dart:_internal/iterable.dart:417)
3 #2 ListIterable.toList (dart:_internal/iterable.dart:221)
4 #3 AndroidMotionEvent._asList (package:flutter/src/services/platform_views.dart:408)
5 #4 AndroidViewController.sendMotionEvent (package:flutter/src/services/platform_views.dart:615)
6 #5 _MotionEventsDispatcher.dispatchPointerEvent (package:flutter/src/rendering/platform_view.dart:649)
7 #6 _MotionEventsDispatcher.handlePointerEvent (package:flutter/src/rendering/platform_view.dart:577)
8 #7 _PlatformViewGestureRecognizer.handleEvent (package:flutter/src/rendering/platform_view.dart:511)
9 #8 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:76)
10 #9 PointerRouter._dispatchEventToRoutes.<anonymous closure> (package:flutter/src/gestures/pointer_router.dart:117)
11 #10 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:379)
12 #11 PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:115)
13 #12 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:101)
14 #13 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:218)
15 #14 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:198)
16 #15 GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:156)
17 #16 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:102)
18 #17 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:86)
19 #18 _rootRunUnary (dart:async/zone.dart:1138)
20 #19 _CustomZone.runUnary (dart:async/zone.dart:1031)
21 #20 _CustomZone.runUnaryGuarded (dart:async/zone.dart:933)
22 #21 _invoke1 (dart:ui/hooks.dart:273)
23 #22 _dispatchPointerDataPacket (dart:ui/hooks.dart:182)

@iapicca
Copy link
Contributor

iapicca commented Apr 22, 2020

Hi all
if the issue persist with the latest stable version of flutter
could you please provide your flutter doctor -v ,
your flutter run --verbose
and a reproducible minimal code sample.

Given these prs
flutter/engine#13697,
#44217,
could be useful to check if reproduces on the latest master as well

Thank you

@iapicca iapicca added in triage Presently being triaged by the triage team waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds labels Apr 22, 2020
@tvqphong001
Copy link

I have same bug, when i use setOnTouchListener in native, when i keep touch and press button off screen

@no-response
Copy link

no-response bot commented May 19, 2020

Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away!
Thanks for your contribution.

@no-response no-response bot closed this as completed May 19, 2020
Mobile - Android platform view review automation moved this from Awaiting triage to Engineer reviewed May 19, 2020
@tvqphong001
Copy link

tvqphong001 commented May 19, 2020

E/flutter: [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: NoSuchMethodError: The method '_asList' was called on null. Receiver: null Tried calling: _asList() #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5) #1 AndroidMotionEvent._asList.<anonymous closure> (package:flutter/src/services/platform_views.dart:402:74) #2 MappedListIterable.elementAt (dart:_internal/iterable.dart:417:31) #3 ListIterable.toList (dart:_internal/iterable.dart:221:19) #4 AndroidMotionEvent._asList (package:flutter/src/services/platform_views.dart:402:85) #5 AndroidViewController.sendMotionEvent (package:flutter/src/services/platform_views.dart:608:15) #6 _MotionEventsDispatcher.dispatchPointerEvent (package:flutter/src/rendering/platform_view.dart:650:20) #7 _MotionEventsDispatcher.handlePointerEvent (package:flutter/src/rendering/platform_view.dart:578:5) #8 _PlatformViewGestureRecognizer.handleEvent (package:flutter/src/rendering/platform_view.dart:512:26) #9 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:76:12) #10 PointerRouter._dispatchEventToRoutes.<anonymous closure> (package:flutter/src/gestures/pointer_router.dart:122:9) #11 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:379:8) #12 PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:120:18) #13 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:106:7) #14 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:218:19) #15 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:198:22) #16 GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:156:7) #17 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:102:7) #18 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:86:7) #19 _rootRunUnary (dart:async/zone.dart:1196:13) #20 _CustomZone.runUnary (dart:async/zone.dart:1085:19) #21 _CustomZone.runUnaryGuarded (dart:async/zone.dart:987:7) #22 _invoke1 (dart:ui/hooks.dart:275:10) #23 _dispatchPointerDataPacket (dart:ui/hooks.dart:184:5)

when I hold down on 2 View have setOnTouchListener and press button physical LOCK SCREEN, do some time and it crash when i click that View.

flutter doctor:

`Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.17.0, on Linux, locale en_US.UTF-8)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[✓] Android Studio (version 3.6)
[✓] Connected device (1 available)
`

@iapicca iapicca removed in triage Presently being triaged by the triage team waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds labels May 20, 2020
@eggfly
Copy link
Member

eggfly commented Jun 11, 2021

I solved this problem by a sinple modification in packages/flutter/lib/src/rendering/platform_view.dart:

bool isSinglePointerAction(PointerEvent event) =>
//change from 
      !(event is PointerDownEvent) && !(event is PointerUpEvent); 
//to
      !(event is PointerDownEvent) && !(event is PointerUpEvent) && !(event is PointerCancelEvent);

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: platform-views Embedding Android/iOS views in Flutter apps c: crash Stack traces logged to the console f: gestures flutter/packages/flutter/gestures repository. framework flutter/packages/flutter repository. See also f: labels. platform-android Android applications specifically
Projects
Development

No branches or pull requests

10 participants