我正在尝试使用 expo 将 expo-location 导入到我的反应原生应用程序中。
我使用以下命令安装了库:
npx expo install expo-location
导入它:
import * as Location from 'expo-location'
但是一旦我添加导入,应用程序就会中断并出现以下错误:
Error: Cannot find native module 'ExpoLocation', js engine: hermes [Component Stack]
我的app.json文件有
"plugins": [
[
"expo-location",
{
"locationAlwaysAndWhenInUsePermission": "Allow this app to use your location."
}
],
你需要重建项目
eas build --profile development --platform android
更多信息在这里:https://docs.expo.dev/develop/development-builds/create-a-build/