Day 9 設置完專案編號後,用指令 adb devices
查看目前連到桌機的實體手機裝置列表。
List of devices attached
(省略) device
(省略) device
指令 npx expo run:android --device
,在實體手機裝置上開啟 React Android 應用程式。
但出現下列錯誤訊息:
📝 Android package Learn more: https://expo.fyi/android-package
CommandError: Input is required, but 'npx expo' is in non-interactive mode.
Project must have aandroid.package
set in the Expo config (app.json or app.config.js).
AI 提示需要先設定 package 名稱。位置在 expo 的 android 區塊裡面,如下:
檔案 app.json
{
"expo": {
"name": "NotificationProgress",
"slug": "NotificationProgress",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"userInterfaceStyle": "light",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"ios": {
"supportsTablet": true
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#ffffff"
},
"package": "你的 package 名稱"
},
"web": {
"favicon": "./assets/favicon.png"
},
"extra": {
"eas": {
"projectId": "省略"
}
}
}
}