Android/Gradle
Android Gradle - signingConfigs
강태종
2022. 3. 10. 01:33
signingConfigs
Android에서 Build를 할 때 Sining Key는 필수 사항이다. 물론 debug 모드로 빌드를 진행하면 Android Studio 내부에서 기본으로 제공하는 Key로 빌드를 하지만 앱을 배포하거나 BuildVariant를 release로 바꾸면 Key를 요구하며 때로는 debug Key를 개발자가 수정하는 경우가 생긴다.
build.gradle 설정
signingConfigs
프로젝트에서 사용할 키를 signingConfig 함수를 통해 설정한다. build.gradle에 Key에 대한 정보를 바로 기입할 수 있지만, properties에 변수로 선언하여 사용할 수 있다.
android {
signingConfigs {
debugKey {
storeFile file('debug.keystore')
storePassword '123123'
keyAlias 'taetae'
keyPassword '123123'
}
releaseKey {
storeFile file(RELEASE_KEY_STORE)
storePassword RELEASE_KEY_PASSWORD
keyAlias RELEASE_KEY_ALIAS
keyPassword RELEASE_KEY_ALIAS_PASSWORD
}
}
}
- storeFile : keystore 파일을 기입한다.
- storePassword : keystore의 비밀번호를 기입한다.
- keyAlias : keystore에 있는 Alias를 기입한다.
- keyPassword : Alias의 비밀번호를 기입한다.
buildTypes
signingConfigs에서 설정한 Key를 buildType에서 기입한다. 기본으로 사용하는 Key는 defaultConfigs에 기입할 수 있다.
android {
buildTypes {
debug {
manifestPlaceholders["appLabel"] = "Build Debug"
applicationIdSuffix = ".debug"
signingConfig signingConfigs.debugKey
minifyEnabled false
debuggable true
}
release {
signingConfig signingConfigs.releaseKey
minifyEnabled true
debuggable false
}
}
}