-
[Android] Play Store 업데이트, zipalign 사용법Programming 2016. 12. 12. 01:07
+ 내용 추가 (2017.1.8)
최신 버전의 Android Studio에서는 KeyStore 세팅만 잘 되어 있으면 Zipalign을 사용할 필요 없이 Build > Generate Signed APK 메뉴를 통해 Release APK를 바로 뽑아낼 수 있다.
Play Store에 배포하는 절차 중 정리해 두어야 할 포인트를 기록하고자 포스팅. 기본적으로 Play Store에 어떻게 배포하는지 아래에 잘 설명되어 있다.
https://support.google.com/googleplay/android-developer/answer/113469?hl=ko
대부분 읽어보면 쉽게 채울 수 있는 항목이고 시간이 오래 걸리지 않는다. (스크린샷, 배포 국가 설정, 저작권, 언어, App 설명 등) 다만 업로드 할 APK는 정식으로 서명 되어 있어야만 스토어에 배포할 수 있다. 자세한 설명은 아래 링크와 함께 참고..
Android requires that all APKs be digitally signed with a certificate before they can be installed. This document describes how to sign your APKs using Android Studio, including creating and storing your certificate, signing different build configurations using different certificates, and configuring the build process to sign your APKs automatically.
https://developer.android.com/studio/publish/app-signing.html
최초로 APK를 서명할 때는 다음 링크부터 참고하면 된다.
Sign your release build
https://developer.android.com/studio/publish/app-signing.html#release-mode
만약 Key Store를 최초로 등록할 경우 비밀번호를 설정해야 하는데 이를 잊어버리게 되면 APK 배포 이후 새버전 업데이트를 할 때 문제가 되므로 잘 관리해야 한다. (잃어버리면 되찾을 수 없음)
정리하자면
다음과 같고, (1)은 최초 signing시에만 생성하면 된다.
1. KeyStore 생성
2. KeyStore를 사용해 Signed APK 만들기
2.1. unaligned -> aligned APK로 변환
3. Developer Console로 이동 후 APK 업로드 및 배포
zipalign사용하여 align APK 만들기
zipalign -v -p 4 my-app-unsigned.apk my-app-unsigned-aligned.apk
APK 버전 관리 Tip
스토어에 배포할 때 반드시 versionCode를 업데이트 해주어야 하는데, build.gradle에 다음과 같이 설정하면 버전이 포함된 이름으로 APK를 생성해 주기 때문에 꽤나 관리하기에 편리하다.
(versionCode, versionName은 직접 카운팅 해주어야 하는 것은 함정)setProperty("archivesBaseName", "com.example.myapp-$versionName")
apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "24.0.1" defaultConfig { applicationId "com.example.myapp" minSdkVersion 19 targetSdkVersion 23 versionCode 2 versionName "0.0.2" setProperty("archivesBaseName", "com.example.myapp-$versionName") } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:23.4.0' }
'Programming' 카테고리의 다른 글
[Android] 피카소(Picasso) 라이브러리 소개 및 주의할 점 (0) 2017.09.23 [Android] Asset Studio 활용하여 해상도별 Launcher Icon 세팅하기 (0) 2017.01.08 [Algorithm] 부분 집합(power set) (1) 2016.10.26 [Algorithm] 순열 조합 (0) 2016.10.23