Skip to content

Check for Android package before running memory tests #9706

Closed

Description

@cbracken

Steps to Reproduce

  1. In dev/devicelab/lib/tasks/perf_tests.dart, change the package of the hello_world test to something else (e.g., io.flutter.broken.hello_world).
  2. Run the above test.

Expected behaviour: error that no such package is present.
Actual behaviour: timeout

Looks like adb has an adb pm list packages command that might be useful as an test that the package exists.

Logs

[hello_world__memory] [STDOUT] [  +57 ms] Time to first frame: 396ms.
[hello_world__memory] [STDOUT] [        ] Saved startup trace info in build/start_up_info.json.
[hello_world__memory] [STDOUT] [        ] Application finished.
[hello_world__memory] [STDOUT] [  +19 ms] 'flutter run' took 34,753ms.
[hello_world__memory] [STDOUT] [  +39 ms] ensureAnalyticsSent: 37ms
[hello_world__memory] [STDOUT] [   +2 ms] exiting with code 0
[hello_world__memory] [STDOUT] Executing: /Users/cbracken/Library/Android/sdk/platform-tools/adb shell dumpsys meminfo io.flutter.examples.HelloWorld
[hello_world__memory] [STDERR] Task failed: NoSuchMethodError: The method 'group' was called on null.
[hello_world__memory] [STDERR] Receiver: null
[hello_world__memory] [STDERR] Tried calling: group(1)
[hello_world__memory] [STDERR]
[hello_world__memory] [STDERR] Stack trace:
[hello_world__memory] [STDERR] dart:core                                                  Object.noSuchMethod
[hello_world__memory] [STDERR] package:flutter_devicelab/framework/adb.dart 263:35        AndroidDevice.getMemoryStats
[hello_world__memory] [STDERR] package:flutter_devicelab/tasks/perf_tests.dart 261:59     MemoryTest.call.<fn>
[hello_world__memory] [STDERR] package:flutter_devicelab/framework/utils.dart 282:24      inDirectory
[hello_world__memory] [STDERR] package:flutter_devicelab/tasks/perf_tests.dart 234:12     MemoryTest.call
[hello_world__memory] [STDERR] package:flutter_devicelab/framework/framework.dart 125:36  _TaskRunner._performTask.<fn>
[hello_world__memory] [STDERR] package:stack_trace                                        Chain.capture
[hello_world__memory] [STDERR] package:flutter_devicelab/framework/framework.dart 124:11  _TaskRunner._performTask
[hello_world__memory] [STDERR] package:flutter_devicelab/framework/framework.dart 84:39   _TaskRunner.run
[hello_world__memory] [STDERR] package:flutter_devicelab/framework/framework.dart 69:39   _TaskRunner._TaskRunner.<fn>
[hello_world__memory] [STDERR] ===== asynchronous gap ===========================
[hello_world__memory] [STDERR] dart:async                                                 _Completer.completeError
[hello_world__memory] [STDERR] package:flutter_devicelab/framework/adb.dart 265:3         AndroidDevice.getMemoryStats
[hello_world__memory] [STDERR] ===== asynchronous gap ===========================
[hello_world__memory] [STDERR] dart:async                                                 _asyncThenWrapperHelper
[hello_world__memory] [STDERR] package:flutter_devicelab/framework/adb.dart 259:73        AndroidDevice.getMemoryStats
[hello_world__memory] [STDERR] package:flutter_devicelab/tasks/perf_tests.dart 261:59     MemoryTest.call.<fn>
[hello_world__memory] [STDERR] ===== asynchronous gap ===========================
[hello_world__memory] [STDERR] dart:async                                                 _asyncThenWrapperHelper
[hello_world__memory] [STDERR] package:flutter_devicelab/tasks/perf_tests.dart 234:48     MemoryTest.call.<fn>
[hello_world__memory] [STDERR] package:flutter_devicelab/framework/utils.dart 282:24      inDirectory
[hello_world__memory] [STDERR] ===== asynchronous gap ===========================
[hello_world__memory] [STDERR] dart:async                                                 Future.Future.microtask
[hello_world__memory] [STDERR] package:flutter_devicelab/framework/utils.dart 278:80      inDirectory
[hello_world__memory] [STDERR] package:flutter_devicelab/tasks/perf_tests.dart 234:12     MemoryTest.call
[hello_world__memory] [STDERR] package:flutter_devicelab/framework/framework.dart 125:36  _TaskRunner._performTask.<fn>
[hello_world__memory] [STDERR] ===== asynchronous gap ===========================
[hello_world__memory] [STDERR] dart:async                                                 Future.Future.microtask
[hello_world__memory] [STDERR] package:flutter_devicelab/framework/framework.dart 124:28  _TaskRunner._performTask.<fn>
[hello_world__memory] [STDERR] package:stack_trace                                        Chain.capture
[hello_world__memory] [STDERR] package:flutter_devicelab/framework/framework.dart 124:11  _TaskRunner._performTask
[hello_world__memory] [STDERR] package:flutter_devicelab/framework/framework.dart 84:39   _TaskRunner.run
[hello_world__memory] [STDERR]
Task result:
{
  "success": false,
  "reason": "Task failed: NoSuchMethodError: The method 'group' was called on null.\nReceiver: null\nTried calling: group(1)"
}

••• Finished task "hello_world__memory" •••

Flutter Doctor

[✓] Flutter (on Mac OS X 10.12.4 16E195, channel master)
    • Flutter at /Users/cbracken/src/flutter/flutter
    • Framework revision ffa8483f3b (27 minutes ago), 2017-05-01 14:18:00 -0700
    • Engine revision da8ebf40bd
    • Tools Dart version 1.23.0-dev.11.11

Activity

  1. added
    a: tests"flutter test", flutter_test, or one of our tests
    on May 1, 2017
  2. added this to the milestone on Jan 3, 2018
  3. MeGaPk commented on Feb 22, 2018

    @MeGaPk

    same problem in ios. I just create new project via Intellij idea and.... same error. Tried on iOS simulator

    ~|⇒ flutter doctor         
    Doctor summary (to see all details, run flutter doctor -v):
    [✓] Flutter (on Mac OS X 10.13.3 17D102, locale en-EE, channel dev)
    [✓] Android toolchain - develop for Android devices (Android SDK 27.0.2)
    [✓] iOS toolchain - develop for iOS devices (Xcode 9.2)
    [✓] Android Studio (version 3.0)
    [✓] IntelliJ IDEA Ultimate Edition (version 2017.3.4)
    [✓] Connected devices
    
    • No issues found!
    
    flutter_test_project|⇒ flutter run -d "iPhone X"
    Launching lib/main.dart on iPhone X in debug mode...
    Unhandled exception:
    NoSuchMethodError: The method 'group' was called on null.
    Receiver: null
    Tried calling: group(1)
    #0      Object.noSuchMethod (dart:core-patch/dart:core/object_patch.dart:46)
    #1      IOSSimulator.sdkMajorVersion (package:flutter_tools/src/ios/simulators.dart:446)
    <asynchronous suspension>
    #2      IOSSimulator.ensureLogsExists (package:flutter_tools/src/ios/simulators.dart:470)
    <asynchronous suspension>
    #3      _IOSSimulatorLogReader._start (package:flutter_tools/src/ios/simulators.dart:539)
    <asynchronous suspension>
    #4      _runGuarded (dart:async/stream_controller.dart:804)
    #5      _BroadcastStreamController._subscribe (dart:async/broadcast_stream_controller.dart:217)
    #6      _ControllerStream._createSubscription (dart:async/stream_controller.dart:817)
    #7      _StreamImpl.listen (dart:async/stream_impl.dart:466)
    #8      FlutterDevice.startEchoingDeviceLog (package:flutter_tools/src/resident_runner.dart:235)
    #9      FlutterDevice.runHot (package:flutter_tools/src/resident_runner.dart:278)
    <asynchronous suspension>
    #10     HotRunner.run (package:flutter_tools/src/run_hot.dart:216)
    <asynchronous suspension>
    #11     RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:340)
    <asynchronous suspension>
    #12     FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:290)
    <asynchronous suspension>
    #13     FlutterCommand.run (package:flutter_tools/src/runner/flutter_command.dart:228)
    <asynchronous suspension>
    #14     CommandRunner.runCommand (package:args/command_runner.dart:194)
    <asynchronous suspension>
    #15     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:284)
    <asynchronous suspension>
    #16     CommandRunner.run.<anonymous closure> (package:args/command_runner.dart:109)
    #17     new Future.sync (dart:async/future.dart:222)
    #18     CommandRunner.run (package:args/command_runner.dart:109)
    #19     FlutterCommandRunner.run (package:flutter_tools/src/runner/flutter_command_runner.dart:166)
    #20     run.<anonymous closure> (package:flutter_tools/runner.dart:89)
    <asynchronous suspension>
    #21     AppContext._run (package:flutter_tools/src/base/context.dart:76)
    <asynchronous suspension>
    #22     AppContext.runInZone.<anonymous closure> (package:flutter_tools/src/base/context.dart:66)
    #23     _rootRun (dart:async/zone.dart:1126)
    #24     _CustomZone.run (dart:async/zone.dart:1023)
    #25     runZoned (dart:async/zone.dart:1501)
    #26     AppContext.runInZone (package:flutter_tools/src/base/context.dart:65)
    #27     run (package:flutter_tools/runner.dart:61)
    <asynchronous suspension>
    #28     main (package:flutter_tools/executable.dart:48)
    <asynchronous suspension>
    #29     main (file:///Users/ivan/flutter/packages/flutter_tools/bin/flutter_tools.dart:16)
    #30     _startIsolate.<anonymous closure> (dart:isolate-patch/dart:isolate/isolate_patch.dart:277)
    #31     _RawReceivePortImpl._handleMessage (dart:isolate-patch/dart:isolate/isolate_patch.dart:165)
    

    UPDATED:

    Oh, that error mean, "before use, run your ios app first time via xcode".

  4. mxcl commented on Mar 8, 2018

    @mxcl

    Oh, that error mean, "before use, run your ios app first time via xcode".

    I did this but still get this error.

  5. mxcl commented on Mar 9, 2018

    @mxcl

    K turned out this happens if your simulator is from an Xcode beta. Google need to make their regex for checking SDK major version less flakey.

  6. cbracken commented on Mar 13, 2018

    @cbracken
    MemberAuthor

    @mxcl can you provide a little more detail? I'm not able to reproduce this issue with Xcode 9.3 beta 4.

    Specifically the output of the following commands would be useful to help understand what's going on:

    1. flutter doctor -v
    2. xcode-select -p
    3. flutter run -v -d "iPhone X"
  7. kiriny commented on Mar 22, 2018

    @kiriny

    flutter doctor -v

    [✓] Flutter (Channel beta, v0.1.5, on Mac OS X 10.13.3 17D102, locale en-US)
        • Flutter version 0.1.5 at /Users/kiriny/Documents/flutter
        • Framework revision 3ea4d06340 (4 weeks ago), 2018-02-22 11:12:39 -0800
        • Engine revision ead227f118
        • Dart version 2.0.0-dev.28.0.flutter-0b4f01f759
    
    [✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
        • Android SDK at /Users/kiriny/Library/Android/sdk
        • Android NDK location not configured (optional; useful for native profiling support)
        • Platform android-27, build-tools 27.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-915-b08)
    
    [✓] iOS toolchain - develop for iOS devices (Xcode 9.2)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Xcode 9.2, Build version 9C40b
        • ios-deploy 1.9.2
        • CocoaPods version 1.4.0
    
    [✓] Android Studio (version 3.0)
        • Android Studio at /Applications/Android Studio.app/Contents
        • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)
    
    [✓] IntelliJ IDEA Ultimate Edition (version 2017.3.4)
        • Flutter plugin version 22.2.2
        • Dart plugin version 173.4548.30
    
    [✓] Connected devices (1 available)
        • iPhone X • ACFA40B1-1D00-46B2-A614-3889E4022DE4 • ios • com.apple.CoreSimulator.SimRuntime.iOS-11-3 (simulator)
    
    • No issues found!
    

    xcode-select -p
    /Applications/Xcode.app/Contents/Developer

    flutter run -v -d "iPhone X"

    [  +13 ms] [/Users/kiriny/Documents/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
    [  +34 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
    [        ] origin/beta
    [        ] [/Users/kiriny/Documents/flutter/] git rev-parse --abbrev-ref HEAD
    [   +9 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
    [        ] beta
    [        ] [/Users/kiriny/Documents/flutter/] git ls-remote --get-url origin
    [  +11 ms] Exit code 0 from: git ls-remote --get-url origin
    [        ] https://github.com/flutter/flutter.git
    [        ] [/Users/kiriny/Documents/flutter/] git log -n 1 --pretty=format:%H
    [  +14 ms] Exit code 0 from: git log -n 1 --pretty=format:%H
    [        ] 3ea4d06340a97a1e9d7cae97567c64e0569dcaa2
    [        ] [/Users/kiriny/Documents/flutter/] git log -n 1 --pretty=format:%ar
    [  +11 ms] Exit code 0 from: git log -n 1 --pretty=format:%ar
    [        ] 4 weeks ago
    [        ] [/Users/kiriny/Documents/flutter/] git describe --match v*.*.* --first-parent --long --tags
    [  +13 ms] Exit code 0 from: git describe --match v*.*.* --first-parent --long --tags
    [        ] v0.1.5-0-g3ea4d0634
    [ +134 ms] "flutter run" took 72ms.
    Error: No pubspec.yaml file found.
    This command should be run from the root of your Flutter project.
    Do not run this command from the root of your git clone of Flutter.
    
    #0      FlutterCommand.validateCommand (package:flutter_tools/src/runner/flutter_command.dart:373)
    <asynchronous suspension>
    #1      RunCommand.validateCommand (package:flutter_tools/src/commands/run.dart:218)
    <asynchronous suspension>
    #2      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:269)
    <asynchronous suspension>
    #3      FlutterCommand.run (package:flutter_tools/src/runner/flutter_command.dart:228)
    <asynchronous suspension>
    #4      CommandRunner.runCommand (package:args/command_runner.dart:194)
    <asynchronous suspension>
    #5      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:286)
    <asynchronous suspension>
    #6      CommandRunner.run.<anonymous closure> (package:args/command_runner.dart:109)
    #7      new Future.sync (dart:async/future.dart:222)
    #8      CommandRunner.run (package:args/command_runner.dart:109)
    #9      FlutterCommandRunner.run (package:flutter_tools/src/runner/flutter_command_runner.dart:166)
    #10     run.<anonymous closure> (package:flutter_tools/runner.dart:90)
    <asynchronous suspension>
    #11     AppContext._run (package:flutter_tools/src/base/context.dart:76)
    <asynchronous suspension>
    #12     AppContext.runInZone.<anonymous closure> (package:flutter_tools/src/base/context.dart:66)
    #13     _rootRun (dart:async/zone.dart:1126)
    #14     _CustomZone.run (dart:async/zone.dart:1023)
    #15     runZoned (dart:async/zone.dart:1501)
    #16     AppContext.runInZone (package:flutter_tools/src/base/context.dart:65)
    #17     run (package:flutter_tools/runner.dart:61)
    <asynchronous suspension>
    #18     main (package:flutter_tools/executable.dart:48)
    <asynchronous suspension>
    #19     main (file:///Users/kiriny/Documents/flutter/packages/flutter_tools/bin/flutter_tools.dart:16)
    #20     _startIsolate.<anonymous closure> (dart:isolate-patch/dart:isolate/isolate_patch.dart:277)
    #21     _RawReceivePortImpl._handleMessage (dart:isolate-patch/dart:isolate/isolate_patch.dart:165)
    
    
    [ +270 ms] ensureAnalyticsSent: 253ms
    [   +1 ms] exiting with code 1
    
  8. cbracken commented on Mar 22, 2018

    @cbracken
    MemberAuthor

    @kiriny in your case it looks like you're running from a directory that does not include a pubspec.yaml file. This doesn't appear related, but I suspect you should be good to go if you run from your project directory.

  9. cbracken commented on Mar 22, 2018

    @cbracken
    MemberAuthor

    @MeGaPk @mxcl your issue should be resolved by #15628.

  10. cbracken commented on Mar 22, 2018

    @cbracken
    MemberAuthor

    /cc @yjbanov (in case you can think of an obvious and quick fix/check we could do here)

    Note: the original bug is specific to running our internal Flutter performance tests on Android devices/emulators, specifically related to us providing better detection when the test contains a bug specifying the wrong Android package.

    Closing since this is really meant to catch what should be an incredibly rare source of user error in local runs of our devicelab tests, and should really only affect developers working on Flutter itself.

  11. github-actions commented on Aug 8, 2021

    @github-actions

    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.

  12. locked as resolved and limited conversation to collaborators on Aug 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: tests"flutter test", flutter_test, or one of our testsplatform-androidAndroid applications specifically

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions