flutter / flutter/devtools

Flutter DevTools Performance page fails to load on nubia Pad Pro

Đang mở
#9,927 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
P2 performance > perfetto screen: performance
Ngôn ngữ chính
Dart
Star
1.7k
Fork
404
Merge trung bình
6 ngày 17 giờ
Pull request đã merge (30 ngày)
18

Mô tả

### Steps to reproduce

1.Create a fresh Flutter project.

2.Run the application on a nubia Pad Pro device.

### Actual results

Context
I am currently developing a project targeting the nubia Pad Pro. Previously, I encountered a startup issue with this device, which was resolved by following the solution in [flutter/flutter#144999](https://github.com/flutter/flutter/issues/144999). This required disabling a specific hidden option on the device, suggesting it might have a non-standard system configuration compared to other Android devices.

Description
The current issue is that after launching Flutter DevTools, all other tabs work as expected except for the Performance page, which fails to open.

The following error messages are visible in the browser console:

Image

Workaround
After investigating with AI and exploring the source code, I found a temporary workaround. Running the following ADB commands to stop/reset atrace before launching the project allows the Performance page to load correctly:

```
adb shell atrace --async_stop >/dev/null 2>&1
adb shell atrace --async_stop --only_userspace >/dev/null 2>&1

adb shell setprop debug.atrace.tags.enableflags 0
adb shell setprop debug.atrace.app_number 0
adb shell setprop debug.atrace.app_0 ""
adb shell setprop debug.atrace.user_initiated ""
adb shell setprop debug.atrace.prefer_sdk 0
```

AI Summary of the Issue
Here is a summary of the underlying problem provided by the AI:

> Conclusion / Root cause
>
> This does not appear to be caused by Flutter flavors, VS Code launch configuration, or project-specific code.
>
> The issue is device-specific. I reproduced it with a newly created Flutter project on a nubia Pad Pro, while the same project works correctly on another Android phone.
>
> On the affected device, Flutter logs the following during app startup:
>
> ATrace was enabled at startup. Flutter and Dart tracing will be forwarded to systrace and will not show up in Dart DevTools.
>
> After that, opening the DevTools Performance page fails with:
>
> getPerfettoVMTimeline: (114)
> A recorder of type "Systrace" is currently in use. As a result, timeline events are handled by the OS rather than the VM.
>
> So the root cause is that Android ATrace/System Tracing is enabled on the device before the Flutter engine starts. Flutter detects this at startup and switches the Dart/Flutter timeline recorder to Systrace. Because of that, DevTools cannot read the VM timeline through getPerfettoVMTimeline, and the Performance page keeps spinning.
>
> The relevant device properties were:
>
> debug.atrace.app_0 = *
> debug.atrace.app_number = 1
> debug.atrace.tags.enableflags = 0xee8fe
>
> Disabling com.android.traceur alone did not fix the issue, so this seems to be caused by device/ROM-level tracing state rather than only the Android System Tracing UI app.
>
> Workaround:
>
> Run the following commands after reboot and before starting the Flutter app:
>
> adb shell atrace --async_stop
> adb shell atrace --async_stop --only_userspace
> adb shell setprop debug.atrace.tags.enableflags 0
> adb shell setprop debug.atrace.app_number 0
> adb shell setprop debug.atrace.prefer_sdk 0
>
> After that, the properties become:
>
> debug.atrace.app_number = 0
> debug.atrace.tags.enableflags = 0
>
> Then Flutter no longer prints "ATrace was enabled at startup", and the DevTools Performance page opens normally.
>
> This workaround is not persistent across reboot, so it needs to be applied again before launching Flutter on this device.

**However, this workaround does not persist after a device reboot.** I am sharing my troubleshooting process here in hopes that it provides insights for implementing a more robust or permanent fix for loading the Performance page.

### Logs

### Flutter Doctor output

[✓] Flutter (Channel stable, 3.41.7, on macOS 26.4.1 25E253 darwin-arm64, locale
zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 26.4.1)
[✓] Chrome - develop for the web
[✓] Connected device (5 available)
! Error: Browsing on the local area network for knife_iphone16. Ensure the
device is unlocked and attached with a cable or associated with the same
local area network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code
-27)
! Error: Browsing on the local area network for Fish’s iPhone. Ensure the
device is unlocked and attached with a cable or associated with the same
local area network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code
-27)
[✓] Network resources

• No issues found!

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Tái hiện lỗi trên nubia Pad Pro với tính năng Android tracing được bật, sau đó bắt đầu từ trang Performance của DevTools và lỗi getPerfettoVMTimeline được mô tả trong báo cáo. So sánh hành vi với các lệnh đặt lại ADB được cung cấp và với một thiết bị không có ATrace đang hoạt động; được xem là hoàn tất khi trang Performance tải ổn định mà không cần dùng workaround khởi động lại.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
android, dart
Lĩnh vực
devtools, performance
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
42/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.