为什么 Flutter 配置文件不适用于 IA 模拟器上的 AOSP

Why Flutter profile is not working on AOSP on IA Emulator

我在 Android Studio 中新创建的虚拟设备在 IA Emulator 上被识别为 AOSP。
这不会造成任何问题 运行在调试模式下运行应用程序,但是当我想添加 --profile 参数以检查 性能 选项卡来自 Dev Tools 它没有 运行 我收到此错误消息:

[  +31 ms] executing: /usr/bin/xcodebuild -version
[   +6 ms] Exit code 1 from: /usr/bin/xcodebuild -version
[        ] xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
[   +5 ms] ro.hardware = ranchu
[{"event":"daemon.connected","params":{"version":"0.6.0","pid":27682}}]
[  +57 ms] "flutter run" took 858ms.
[   +2 ms] ensureAnalyticsSent: 0ms
[   +2 ms] Running shutdown hooks
[        ] Shutdown hooks complete
[        ] exiting with code 1
[   +6 ms] Exception: Profile mode is not supported for AOSP on IA Emulator.
[   +3 ms] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:14:3)
           #1      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:469:9)
           <asynchronous suspension>
           #2      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:977:18)
           <asynchronous suspension>
           #3      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:836:33)
           <asynchronous suspension>
           #4      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart)
           #5      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:29)
           #6      _rootRun (dart:async/zone.dart:1190:13)
           #7      _CustomZone.run (dart:async/zone.dart:1093:19)
           #8      _runZoned (dart:async/zone.dart:1630:10)
           #9      runZoned (dart:async/zone.dart:1550:10)
           #10     AppContext.run (package:flutter_tools/src/base/context.dart:149:18)
           #11     FlutterCommand.run (package:flutter_tools/src/runner/flutter_command.dart:825:20)
           #12     CommandRunner.runCommand (package:args/command_runner.dart:197:27)
           #13     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:335:21)
           #14     _rootRunUnary (dart:async/zone.dart:1198:47)
           #15     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
           #16     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
           #17     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
           #18     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
           #19     Future._completeWithValue (dart:async/future_impl.dart:529:5)
           #20     Future._asyncCompleteWithValue.<anonymous closure> (dart:async/future_impl.dart:567:7)
           #21     _rootRun (dart:async/zone.dart:1190:13)
           #22     _CustomZone.run (dart:async/zone.dart:1093:19)
           #23     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
           #24     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
           #25     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
           #26     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
           #27     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
           #28     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5)

其他人以前遇到过这个问题吗?

您不能运行 flutter 应用程序在仿真器或模拟器上以配置文件模式运行。您只能在真实设备上执行此操作。

来自 Flutter docsProfile mode is disabled on the emulator and simulator, because their behavior is not representative of real performance.

根据此页面 https://flutter.dev/docs/perf/rendering/ui-performance 最好在真实设备上分析您的应用程序。