flutter icon indicating copy to clipboard operation
flutter copied to clipboard

[tool_crash] _TypeError: (#0 IOSDevice.stopApp (package:flutter_tools/src/ios/devices.dart)) type 'Null' is not a subtype of type 'IOSApp' of 'app'

Open jmagman opened this issue 3 years ago • 1 comments
trafficstars

Similar to https://github.com/flutter/flutter/issues/111877

Command

flutter attach --app-id io.flutter.examples.gallery

Steps to Reproduce

  1. flutter run app on iPhone, then d to detach without quitting.
  2. flutter attach to running app.
  3. q to quit

Logs

_TypeError: (#0 IOSDevice.stopApp (package:flutter_tools/src/ios/devices.dart))

#0      IOSDevice.stopApp (package:flutter_tools/src/ios/devices.dart)
#1      FlutterDevice.exitApps (package:flutter_tools/src/resident_runner.dart:358:19)
#2      ResidentRunner.exitApp (package:flutter_tools/src/resident_runner.dart:1431:67)
#3      ResidentRunner.exit (package:flutter_tools/src/resident_runner.dart:1276:11)
<asynchronous suspension>
#4      TerminalHandler._commonTerminalInputHandler (package:flutter_tools/src/resident_runner.dart:1701:9)
<asynchronous suspension>
#5      TerminalHandler.processTerminalInput (package:flutter_tools/src/resident_runner.dart:1760:7)
<asynchronous suspension>
[!] Flutter (Channel main, 3.4.0-19.0.pre.370, on macOS 12.6 21G115 darwin-x64, locale en-US)
    • Flutter version 3.4.0-19.0.pre.370 on channel main at /Users/magder/Projects/flutter
    ! Upstream repository [email protected]:jmagman/flutter.git is not a standard remote.
      Set environment variable "FLUTTER_GIT_URL" to [email protected]:jmagman/flutter.git to dismiss this error.
    • Framework revision 29943e5f73 (26 hours ago), 2022-09-19 19:40:06 -0400
    • Engine revision 5956aa6f38
    • Dart version 2.19.0 (build 2.19.0-217.0.dev)
    • DevTools version 2.17.0
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/magder/Library/Android/sdk
    • Platform android-31, build-tools 30.0.3
    • ANDROID_SDK_ROOT = /Users/magder/Library/Android/sdk
    • Java binary at: /Applications/Android Studio with Blaze Beta.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.0)
    • Xcode at /Users/magder/Applications/Xcode-14.app/Contents/Developer
    • Build 14A309
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.3)
    • Android Studio at /Applications/Android Studio with Blaze Beta.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)

[✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio with Blaze.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

[✓] Android Studio (version 4.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)

[✓] Android Studio (version 2020.3)
    • Android Studio at /Users/magder/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/203.7583922/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

[✓] IntelliJ IDEA Community Edition (version 2021.3.3)
    • IntelliJ at /Applications/IntelliJ CE (stable).app
    • Flutter plugin version 67.0.3
    • Dart plugin version 213.7371

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

[✓] Connected device (3 available)
    • Purple 14 (mobile) • 00008110-0009588C2651401E • ios            • iOS 16.0 20A357
    • macOS (desktop)    • macos                     • darwin-x64     • macOS 12.6 21G115 darwin-x64
    • Chrome (web)       • chrome                    • web-javascript • Google Chrome 105.0.5195.125

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.

Flutter Application Metadata

Type: malformed Version: null Material: true Android X: false Module: false Plugin: false Android package: null iOS bundle identifier: null Creation channel: null Creation framework version: null

Plugins

connectivity-3.0.6 connectivity_for_web-0.4.0+1 connectivity_macos-0.2.1+2 device_info-2.0.3 integration_test url_launcher-6.1.5 url_launcher_android-6.0.17 url_launcher_ios-6.0.17 url_launcher_linux-3.0.1 url_launcher_macos-3.0.1 url_launcher_web-2.0.13 url_launcher_windows-3.0.1 video_player-2.2.11 video_player_web-2.0.12

jmagman avatar Sep 21 '22 02:09 jmagman

Though when I fix the TypeError it crashes later:

Bad state: Cannot add event after closing

the event is {\"jsonrpc\":\"2.0\",\"method\":\"streamCpuSamplesWithUserTag\",\"id\":26,\"params\":{\"userTags\":[]}}, something is still adding to a stream.

jmagman avatar Sep 21 '22 02:09 jmagman

Same problem

9clg6 avatar Apr 26 '23 17:04 9clg6

This issue is missing a priority label. Please set a priority label when adding the triaged-ios label.

flutter-triage-bot[bot] avatar Aug 29 '23 03:08 flutter-triage-bot[bot]

On beta/3.14.0-0.1.pre with this stacktrace:

_TypeError: type 'Null' is not a subtype of type 'IOSApp' of 'package'
at IOSSimulator.startApp(simulators.dart:471)
at FlutterDriverService.start(drive_service.dart:178)
at <asynchronous gap>(async)
at DriveCommand.runCommand(drive.dart:270)
at <asynchronous gap>(async)
at FlutterCommand.run.<anonymous closure>(flutter_command.dart:1323)
at <asynchronous gap>(async)
at AppContext.run.<anonymous closure>(context.dart:150)
at <asynchronous gap>(async)
at CommandRunner.runCommand(command_runner.dart:212)
at <asynchronous gap>(async)
at FlutterCommandRunner.runCommand.<anonymous closure>(flutter_command_runner.dart:339)
at <asynchronous gap>(async)
at AppContext.run.<anonymous closure>(context.dart:150)
at <asynchronous gap>(async)
at FlutterCommandRunner.runCommand(flutter_command_runner.dart:285)
at <asynchronous gap>(async)
at run.<anonymous closure>.<anonymous closure>(runner.dart:115)
at <asynchronous gap>(async)
at AppContext.run.<anonymous closure>(context.dart:150)
at <asynchronous gap>(async)
at main(executable.dart:90)
at <asynchronous gap>(async)

Possible related fix: https://github.com/flutter/flutter/pull/111935

cc @vashworth

christopherfujino avatar Aug 29 '23 20:08 christopherfujino

On beta/3.14.0-0.1.pre with this stacktrace:

_TypeError: type 'Null' is not a subtype of type 'IOSApp' of 'package'
at IOSSimulator.startApp(simulators.dart:471)
at FlutterDriverService.start(drive_service.dart:178)
at <asynchronous gap>(async)
at DriveCommand.runCommand(drive.dart:270)
at <asynchronous gap>(async)
at FlutterCommand.run.<anonymous closure>(flutter_command.dart:1323)
at <asynchronous gap>(async)
at AppContext.run.<anonymous closure>(context.dart:150)
at <asynchronous gap>(async)
at CommandRunner.runCommand(command_runner.dart:212)
at <asynchronous gap>(async)
at FlutterCommandRunner.runCommand.<anonymous closure>(flutter_command_runner.dart:339)
at <asynchronous gap>(async)
at AppContext.run.<anonymous closure>(context.dart:150)
at <asynchronous gap>(async)
at FlutterCommandRunner.runCommand(flutter_command_runner.dart:285)
at <asynchronous gap>(async)
at run.<anonymous closure>.<anonymous closure>(runner.dart:115)
at <asynchronous gap>(async)
at AppContext.run.<anonymous closure>(context.dart:150)
at <asynchronous gap>(async)
at main(executable.dart:90)
at <asynchronous gap>(async)

Possible related fix: #111935

cc @vashworth

So I don't think this is the same issue as this Github issue. This Github issue is for stopApp and this stack trace is for startApp, I filed a new issue for this crash along with my findings: https://github.com/flutter/flutter/issues/134073

vashworth avatar Sep 05 '23 21:09 vashworth