본문 바로가기
CODE/기타

[Google] 구글 플레이 앱 업로드 하기

by Nuridal_class 2024. 11. 27.
728x90
728x90

오늘은 구글 앱을 업데이트 하는 김에 앱 업로드는 어떻게 하는지에 대해서 알아보겠습니다.


앱 업로드 키 만들기

 1. keytool로 keystore 파일 만들기(최초 한번만 진행)

java가 설치된 위치의 ~/bin 폴더에 들어가면 keytool.exe가 있고 이 위치에서 명령을 실행
pem 서명 업로드를 위해서는 터미널을 관리자 권한으로 실행
(이 때 keystore 파일의 위치는 아래를 참고하여 저장해야 코드수정 내용과 맞는 위치가 됩니다)
keytool -genkey -v -keystore "/프로젝트경로/android/app/MyApp.keystore" -alias Nuridal -keyalg RSA -keysize 2048 -validity 365000
이 때 alias 값과 연이어 물어보는 password 은 앱 업데이트 마다 필요하므로 꼭 기억해야 합니다

 

 2. pen 서명 키를 구글 플레이에 업로드(최초 한번만 진행)

구글 플레이에서 최초 앱 업로드시 pem 확장자를 가진 서명 키를 업로드 하도록 되어 있습니다
이 때도 위와 동일한 위치에서 아래 명령을 실행하면 됩니다
keytool -export -rfc -keystore "/프로젝트경로/android/app/MyApp.keystore" -alias Nuridal -file upload_certificate.pem
이 때, 위에서 만든 keystore 파일명과 alias과 password를 적어주면 됩니다

 

 3. 코드 수정

1. android/key.properties 파일은 새로 생성하여 아래와 같이 쓰고 저장
storeFile=MyApp.keystore
keyAlias=위에만든별칭
storePassword=위에만든비번
keyPassword=위에만든비번
2. android/app/build.gradle 는 아래와 같이 내용을 수정, 코드 중 android { 의 윗부분에 추가
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {의 buildTypes{ } 부분을 모두 아래 내용으로 대체
    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
            storePassword keystoreProperties['storePassword']
        }
    }

    buildTypes {
        release {
            signingConfig signingConfigs.release
        }
    }

 

 4. 앱 업데이트 

앱을 최초 등록 후에 업데이트가 필요하면 테스트 및 출시 > 프로덕션 > 새 버전 만들기 클릭

 

여기에 Flutter로 개발한다면 Flutter build appbundle 명령어로 빌드하고 app-release.aab 파일을 넣어주면 됩니다


이번에는 앱 업로드는 어떻게 하는지 대략 적어보았습니다.

조금이나마 도움이 되셨으면 좋겠습니다.

 

 

 

728x90
300x250