สมัคร Expo Dev Account https://expo.dev/signup
รันคำสั่งใน terminal หรือ command prompt
# Windows
npm install -g eas-cli
# MacOS
sudo npm install -g eas-cli
รันคำสั่งด้านล่างเพื่อ login ด้วย Expo Account
eas login
รันคำสั่งด้านล่าง ภายใน root directory ของโปรเจค
eas build:configure
จะได้ไฟล์ eas.json
ออกมา ซึ่งจะใช้สำหรับการ build แอพ ประมาณด้านล่าง
{
"cli": {
"version": ">= 15.0.2",
"appVersionSource": "remote"
},
"build": {
"development": {
"developmentClient": true,
"distribution": "internal"
},
"preview": {
"distribution": "internal",
"android": {
"buildType": "apk"
}
},
"production": {
"autoIncrement": true
}
},
"submit": {
"production": {}
}
}
ให้แน่ใจว่าได้เพิ่ม config ของ build:preview ในไฟล์ eas.json
แล้ว
{
"build": {
"preview": {
"distribution": "internal",
"android": {
"buildType": "apk"
}
}
}
}
บันทึกไฟล์
ให้แน่ใจว่าในไฟล์ app.json
ได้มีการเปลี่ยนชื่อ splash screen จาก
"expo-splash-screen",
{
"image": "./assets/images/splash-icon.png",
"imageWidth": 200,
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
เป็น
"expo-splash-screen",
{
"image": "./assets/images/splash.png",
"imageWidth": 200,
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
ไฟล์ App Icon และ Splash Screen จะอยู่ในโฟลเดอร์ /assets
ของโปรเจค
- assets/images/icon.png (iOS)
- ควรมีขนาด 1024 x 1024 px
- เป็นไฟล์ png
- assets/images/adaptive-icon.png (Android)
- ควรมีขนาด 1024 x 1024 px
- เป็นไฟล์ png
- assets/image/splash.png
- ควรมีขนาดเท่ากับภาพตัวอย่าง
- เป็นไฟล์ png
สามารถปรับเปลี่ยนที่อยู่ของไฟล์รูป App Icon และ Splash Screen ได้ในไฟล์
app.json
รันสั่งคำสั่งด้านล่าง เพื่อเริ่มกระบวนการ build
eas build -p android --profile preview
ระบบจะทำการสร้าง build บน EAS Cloud และเมื่อการ build สมบูรณ์จะส่งไฟล์ APK เพื่อให้เรามาใช้ติดตั้งบนอุปกรณ์ได้
- Expo: status bar, app icon, and splash screen
- การสร้างไฟล์ APK สำหรับ Android หรือไฟล์ IPA สำหรับ iOS เพื่ออัพขึ้น App Store ด้วย EAS สามารถอ่านเพิ่มเติมได้ที่ https://docs.expo.dev/build/setup/#run-a-build