클로드한테 물어봤다. 내가 이해한 과정을 쭉 적어보겠다.
1. 빌드 준비
a. app.json 파일에서 package 이름, versionCode, versionName등을 설정하래. 그게 뭘까?
b. 키스토어 생성
- 안드로이드 앱 서명을 위한 키스토어가 필요하다.
keytool -genkeypair -v -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -storepass YOUR_KEYSTORE_PASSWORD -keypass YOUR_KEY_PASSWORD -alias YOUR_ALIAS_NAME -keystore my-release-key.keystore
이 명령어로 생성할 수 있대. 키스토어가 뭘까?
2. 앱 빌드
a. EAS 설정
- eas.json파일을 생성하고 빌드 프로필을 설정한다. - 이거왠지 내가 안해도 만들어줄거같은데
b. EAS Build 실행
- 터미널에서 다음 명령어를 실행한다
eas build --platform android
빌드가 완료되면 .aab파일을 다운로드 받을 수 있다고 한다. 그걸 구글 플레이스토어에 등록하란다.
npx eas-cli login
npx eas-cli build --platform android
Expo 프로젝트의 디렉토리 구조
루트 디렉토리에 있어야하는 파일 및 폴더 :
package.json - 프로젝트의 메타데이터와 의존성을 정의한다. npm이 이거 읽고 의존성 파일들을 설치한다.
package-lock.json - 쟤보다 엄밀한 패키지제이슨 파일이다. npm이 자동 생성,관리한다.
app.json - 앱의 기본 정보와 플랫폼별 설정이 써있고 빌드 및 배포 과정에서 이 파일의 정보를 사용한다
eas.json - eas 클라우드 서비스 설정 정의. 빌드 및 제출과정 자동화 설정 정의
babel.config.js - Babel은 Js 컴파일러다. 최신버전의 JS를 이전버전으로 변환해주고 JSX를 일반 Js로 변환해준다. 이 config.js 파일이 바벨의 동작방식을 결정한다.
metro.config.js - Metro 번들러의 설정 파일. Js 번들러이다. (번들링 =여러개의 파일을 하나로 묶기)
App.js
Node_modules 폴더 - 모든 dependencies(의존성파일)들이 package.json에 따라 설치된다.
이밖의 파일이나 소스코드들은 통상적으로 assets, src, components 등의 폴더에 배치한다.
App.js를 하위 디렉토리에 넣는다면 app.json의 main 필드를 업데이트 하면된다.
다 까고 보면 쉽다. 쫄지마라 쫄지를
expo eas login 하니까 에러 뜨고
expo eas-cli login 하니까 된다. 뭐지? 아마도 내가 npx를 통해 eas-cli를 사용하고있어서 그런듯
expo eas-cli build:configure 얘도 안되고
npx expo eas-cli build:configure 얘도 안되고
npx eas-cli build:configure 얘는 된다. 이유가 있겄지. npx 로 eas-cli를 쓰는걸겨~
jongwoo@mac expo240709 % npx eas-cli build:configure
EAS project not configured.
✔ Would you like to automatically create an EAS project for @leejongwoo/expo240709? … yes
✔ Created @leejongwoo/expo240709 on Expo
✔ Linked local project to EAS project b24813ee-acf9-4460-8fa2-5181002ddb31
💡 The following process will configure your iOS and/or Android project to be compatible with EAS Build. These changes only apply to your local project files and you can safely revert them at any time.
✔ Which platforms would you like to configure for EAS Build? › Android
✔ Generated eas.json. Learn more
🎉 Your project is ready to build.
- Run eas build when you are ready to create your first build.
- Once the build is completed, run eas submit to upload the app to app stores.
- Learn more about other capabilities of EAS Build
npx eas-cli build
jongwoo@mac expo240709 % npx eas-cli build
✔ Select platform › Android
Loaded "env" configuration for the "production" profile: no environment variables specified. Learn more
📝 Android application id Learn more
✔ What would you like your Android application id to be? … com.leejongwoo.expo240709
✔ Using remote Android credentials (Expo server)
✔ Generate a new Android Keystore? … yes
Detected that you do not have keytool installed locally.
✔ Generating keystore in the cloud...
✔ Created keystore
Compressing project files and uploading to EAS Build. Learn more
✔ Uploaded to EAS
Build details: https://expo.dev/accounts/leejongwoo/projects/expo240709/builds/241f3d80-8796-4a80-90ea-e5862c43c8eb
Waiting for build to complete. You can press Ctrl+C to exit.
Build queued...
Start builds sooner in the priority queue.
Sign up for EAS Production or Enterprise at https://expo.dev/accounts/leejongwoo/settings/subscriptions
Waiting in Free tier queue
|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■|
✔ Build finished
🤖 Android app:
https://expo.dev/artifacts/eas/5sH8z4Fysh671uJdB5hN4D.aab
jongwoo@mac expo240709 %
aab 파일 말고 apk 파일도 만들고 싶다.
//원래 eas.json 파일 내용
{
"cli": {
"version": ">= 10.1.1"
},
"build": {
"development": {
"developmentClient": true,
"distribution": "internal"
},
"preview": {
"distribution": "internal"
},
"production": {}
},
"submit": {
"production": {}
}
}
//수정한 eas.json 파일 내용]
{
"cli": {
"version": ">= 10.1.1"
},
"build": {
"development": {
"developmentClient": true,
"distribution": "internal"
},
"preview": {
"distribution": "internal",
"android": {
"buildType": "apk"
}
},
"production": {}
},
"submit": {
"production": {}
}
}
npx eas-cli build --platform android --profile preview
실행.
저거해놓고 지인들 이메일들 테스터로 등록한다음에 내부 테스트에 aab파일 올렸다.
jongwoo@mac expo240709 % npx eas-cli build --platform android --profile preview
Loaded "env" configuration for the "preview" profile: no environment variables specified. Learn more
✔ Using remote Android credentials (Expo server)
✔ Using Keystore from configuration: Build Credentials Gf8vOtEXiD (default)
Compressing project files and uploading to EAS Build. Learn more
✔ Uploaded to EAS
Build details: https://expo.dev/accounts/leejongwoo/projects/expo240709/builds/03ef7ce4-5bde-48a2-82a2-2efa378393c3
Waiting for build to complete. You can press Ctrl+C to exit.
Build queued...
Start builds sooner in the priority queue.
Sign up for EAS Production or Enterprise at https://expo.dev/accounts/leejongwoo/settings/subscriptions
Waiting in Free tier queue
|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■|
✔ Build finished
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█ ▄▄▄▄▄ █▄▀ ▀ ▀ █▀█▀▄▀ ▄ ▀██▄█ ▄▄▄▄▄ █
█ █ █ █ █▀ █▀▄▀▄█▄█▄ ▄██ █ █ █
█ █▄▄▄█ █▄█▀ ▄ ▄ █ ▀█▄█▄█▀▄▄█ █▄▄▄█ █
█▄▄▄▄▄▄▄█▄█ █ █▄▀▄▀ █▄█▄▀▄█▄▀ █▄▄▄▄▄▄▄█
█▄▄ ▄▀▀▄█ █ ▄ █▀██▄ ▀ ▀▄▀▄▄ ▄█▀▄ ▀▄█
█▄ █ ▄▄█ ▀ ▄▄ ▄█▀▄ ███▀▄█ ▀▀▀ ▀ ▄█ ▀█
█ ▄█ █ ▄ ▄▄▀▀ ▄ ▀▄ ▀ █▀▄▀ ▀▀ ▀ █ █
█▀▄█ ▀ ▄ ▀▄█ █▄ ▀▀█ ▄█ ▀█▄█ ▀▀▀█▀ █▄▀█
█ ▄█▄█▀▄█▀ ██ █ ▀▀███▄█ ▀▄▄▀██▀▀█▀▄ ▀█
██▀▄ █▄▄▄█▀ ██▄ █▀▀▀▄▄██▀▄▄▄ ▄▀▀ ▀▄ ▄█
█ ▀▀ █▀▄ ▄▄ ▀ █▄██▄█▀█▄ ▀█ █ █▀▄██ ██
█▀▀ ▄▄▄▄ ▄ █ ▄▀ █ ▄ ████ ▄▀▄██▀█▄▄ ▀███
██▀▄▀▀ ▄ █ ▀█ ▄█ ▀ █▀▄▀██▀▄▄▀▀ ▀ █ ▄ █
█▀▄▀▄ ▀▄ █▀█▀ █▀▀▄▄▀▄▀ ▀█████▀▄▄ ██▄▄▀█
███▄▄█▄▄▄ ▄▄ ▄ █▄█ ▄ ▄█▄ ▄▄▄ ▄ ▄ █
█ ▄▄▄▄▄ ██ ▄▀█▄▄▄▀▀███████▄▄█ █▄█ █ ▄█
█ █ █ █▀▀ ▀▀██▄ ▀▀ ▀▀█▀▄█ ▄ █▀▄██
█ █▄▄▄█ █ ██ ▄▀▄█▄▄ ▀██▄▄ ▄▀█▀▄ ▄ ███
█▄▄▄▄▄▄▄█▄▄███▄███▄▄▄██▄█▄▄▄███▄▄▄▄▄▄▄█
🤖 Open this link on your Android devices (or scan the QR code) to install the app:
https://expo.dev/accounts/leejongwoo/projects/expo240709/builds/03ef7ce4-5bde-48a2-82a2-2efa378393c3
? Install and run the Android build on an emulator? › (Y/n)
apk파일 빌드됐다. 깔아서 실행해보니까
실행 잘된다.
기분이 너무 좋다