This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.

故障排除 EAS 观察

常见 EAS 观察问题的解决方案。


常见问题

🌐 Common issues

指标未出现在仪表板上

🌐 Metrics not appearing in the dashboard

  1. 确保在安装 expo-observe 后创建了新构建。只有包含该库的构建才会收集指标。
  2. 检查你是否在 EAS 仪表板中查看了正确的项目。
  3. 如果在调试构建中进行测试,请确保通过 configure()dispatchInDebug 设置为 true。请参阅 在开发中启用指标

首次渲染时间未显示

🌐 Time to first render not showing

验证你的根布局是否被根 HOC 封装:

🌐 Verify that your root layout is wrapped with the root HOC:

import { ObserveRoot } from 'expo-observe'; function RootLayout() { return (/* your layout */); } export default ObserveRoot.wrap(RootLayout);

互动时间未显示

🌐 Time to interactive not showing

此指标需要手动测量。请确认:

🌐 This metric requires manual instrumentation. Verify that:

  1. 你在启动画面被隐藏后调用了 markInteractive()(来自 useObserve())。
  2. 该调用实际上正在执行(添加 console.log 以验证)。
从 expo-eas-observe 迁移

如果你曾参与私有预览并且之前使用过 expo-eas-observe,请按照以下步骤迁移到 expo-observe

🌐 If you were part of the private preview and previously used expo-eas-observe, follow these steps to migrate to expo-observe.

1

更换封装

Terminal
npx expo install expo-observe
npm uninstall expo-eas-observe

如果你之前将 expo-eas-client 作为单独的依赖安装,可以将其移除:

🌐 If you previously installed expo-eas-client as a separate dependency, you can remove it:

Terminal
npm uninstall expo-eas-client

2

更新导入

- import AppMetrics from 'expo-eas-observe'; + import { AppMetrics } from 'expo-observe';

3

用根 HOC 替换手动 markFirstRender()

与其手动调用 markFirstRender(),不如用你的 SDK 的根 HOC 封装你的根布局。这会自动处理测量。

🌐 Instead of calling markFirstRender() manually, wrap your root layout with the root HOC for your SDK. This handles the measurement automatically.

之前:

🌐 Before:

import { useEffect } from 'react'; import AppMetrics from 'expo-eas-observe'; export default function RootLayout() { useEffect(() => { AppMetrics.markFirstRender(); }, []); return (/* your layout */); }

之后:

🌐 After:

import { ObserveRoot } from 'expo-observe'; function RootLayout() { return (/* your layout */); } export default ObserveRoot.wrap(RootLayout);

4

创建新版本

完成迁移后,创建你的应用的新版本:

🌐 After completing the migration, create a new build of your app:

Terminal
eas build