Computer Science/Flutter

[Android] keystore๋ž€? keystore ์ƒ์„ฑ ๋ฐฉ๋ฒ• ๋ฐ ์—ญํ• 

_cactus 2023. 9. 26. 14:51
๋ฐ˜์‘ํ˜•
 

[Android] buildType์ด๋ž€? debug vs release ๐Ÿ› 

ํ”„๋กœ์ ํŠธ์˜ buildType์€ ๊ธฐ๋ณธ์ ์œผ๋กœ 2๊ฐœ 1. debug 2. release ์ด ๋‘˜์˜ ๊ฐ€์žฅ ํฐ ์ฐจ์ด๋Š” ๋ฌด์—‡์ธ๊ฐ€ ?? ์งง๊ฒŒ ์š”์•ฝ ํ•˜๋ฉด, ๊ฐœ๋ฐœ์ž๋“ค์ด ์•ฑ์„ ํ…Œ์ŠคํŠธํ•˜๋ฉด์„œ ๋ฒ„๊ทธ๋ฅผ ์ฐพ๊ณ , ๋˜ ๊ทธ ๋ฒ„๊ทธ๋ฅผ ์ˆ˜์ •ํ•˜๊ณ  ํ•˜๋Š” ์ž‘์—…๋“ค์„ debug

mac-user-guide.tistory.com

๐Ÿ‘†๐Ÿ‘†๐Ÿ‘† ์•ž์„œ buildType์˜ ์ข…๋ฅ˜ 2๊ฐ€์ง€, debug์™€ release type์— ๋Œ€ํ•ด ์„ค๋ช…์„ ํ–ˆ์Œ

์œ„ ๊ธฐ๋ฐ˜์œผ๋กœ ์•„๋ž˜ ๋‚ด์šฉ์„ ์„ค๋ช…ํ•  ๊ฒƒ์ž„

 

debug.keystore ์ƒ์„ฑ

debug.keystore๋Š” android sdk๋ฅผ PC์— ์„ค์น˜ํ•˜๋ฉด ๊ธฐ๋ณธ์ ์œผ๋กœ ํฌํ•จ์ด ๋˜์–ด ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ๋”ฐ๋กœ ์ƒ์„ฑํ•˜์ง€ ์•Š์•„๋„ ๋จ!

 

debug.keystore์˜ ์œ„์น˜

  • window : C:/users/.android/debug.keystore
  • Mac: ~/.android/debug.keystore ๋˜๋Š” /Users/.android/debug.keystore

 

 

release.keystore ์ƒ์„ฑ

release.keystore๋Š” ๋ฐฐํฌํ•  ๋ชฉ์ ์„ ๊ฐ€์ง„ apk๋ฅผ signingํ•  ๋•Œ ์“ฐ์ž„

๋งŒ์•ฝ ๋ถ„์‹คํ•˜๊ฒŒ ๋˜๋ฉด google playstore ๋งˆ์ผ“์— ๋ฐฐํฌ์ค‘์ธ ์•ฑ์„ ๊ด€๋ฆฌ/๋ฐฐํฌ/์ˆ˜์ • ํ•  ์ˆ˜ ์—†๊ฒŒ ๋˜๋ฏ€๋กœ ์œ ์ถœ๋˜์ง€ ์•Š๊ฒŒ ์ž˜ ๋ณด๊ด€ํ•ด์•ผํ•จ.

 

์ƒ์„ฑํ•˜๋Š” ๋ฐฉ๋ฒ•

1. Android Studio ์ด์šฉ

2. ํ„ฐ๋ฏธ๋„ ๋ช…๋ น์–ด๋กœ ์ƒ์„ฑ

$ keytool -genkey -v -keystore <keystore name> -alias <alias name> -keyalg <alg name> -keysize <key size> -validity <validity days>

 

์œ„ ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ•˜์—ฌ ์ƒ์„ฑ. (java.jdk๊ฐ€ ์„ค์น˜๋˜์–ด์žˆ์–ด์•ผ ํ•จ)

  • ์˜ˆ)  $ keytool -genkey -v -keystore release.keystore -alias playstore-dev-key -keyalg RSA -keysize 2048 -validity 10000
    •  keystore 
      • ์ƒ์„ฑ๋  .keystore ํ™•์žฅ์ž์˜ ํŒŒ์ผ ์ด๋ฆ„
    • alias
      • ํ‚ค์˜ ๋ณ„๋ช…
    • keyalg
      • ํ‚ค ์•”ํ˜ธํ™” ์•Œ๊ณ ๋ฆฌ์ฆ˜
      • RSA๋‚˜ DSA ์ค‘ ํ•˜๋‚˜๋ฅผ ์„ ํƒ
    • keysize
      • ํ‚ค์˜ ํฌ๊ธฐ
      • ์„ ํƒ์‚ฌํ•ญ์ด๋ฉฐ, ์ด ์˜ต์…˜์„ ๋นผ๋ฉด default๋กœ 1024๋น„ํŠธ์˜ ํฌ๊ธฐ๋กœ ์ €์žฅ๋จ
      • ๊ตฌ๊ธ€์—์„œ๋Š” 2048๋น„ํŠธ ์ด์ƒ์˜ ํ‚ค ํฌ๊ธฐ๋ฅผ ๊ถŒ์žฅ
    • validity
      • ์œ ํšจ๊ธฐ๊ฐ„ (๋‹จ์œ„: ์ผ)
      • ๊ตฌ๊ธ€์—์„œ๋Š” ์ตœ์†Œ 25๋…„ ์ด์ƒ(9125์ผ)์˜ ์œ ํšจ๊ธฐ๊ฐ„์„ ์ž…๋ ฅํ•  ๊ฒƒ์„ ๊ถŒ์žฅ

๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•˜๋ฉด ๋น„๋ฐ€๋ฒˆํ˜ธ ์„ค์ • ~ key ์ƒ์„ฑ์ž์˜ ์ •๋ณด๋ฅผ ์ž…๋ ฅํ•˜๊ฒŒ ๋˜์–ด์žˆ์Œ. ๋‹ค ์ž…๋ ฅํ•˜๊ณ  ๋งˆ์ง€๋ง‰์— Y๋ฅผ ์ž…๋ ฅํ•˜๋ฉด ๋!

์ƒ์„ฑ์ด ์™„๋ฃŒ๋˜๋ฉด ํ„ฐ๋ฏธ๋„ ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•œ ๊ฒฝ๋กœ์— .keystore ํŒŒ์ผ์ด ์ƒ์„ฑ๋˜์–ด์žˆ์Œ

 

๋ฐ˜์‘ํ˜•

Keystore Hash Key ํ™•์ธ

์จ๋“œํŒŒํ‹ฐ๋ฅผ ์‚ฌ์šฉํ•˜๋‹ค๋ณด๋ฉด hash key๋ฅผ ์•Œ์•„์•ผํ•˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ๋งŽ์Œ

 

Android Studio๋ฅผ ์ด์šฉํ•˜์—ฌ hash key ํ™•์ธ ๊ฐ€๋Šฅ

- android gradle์— signing config๊ด€๋ จ script์— ๊ฐ’์„ ์„ค์ •ํ•ด๋‘๋ฉด ํŽธ๋ฆฌํ•จ!!

 

app/build.gradle ํŒŒ์ผ์— debug/release keystore ์ •๋ณด๊ฐ€ ํ•˜๋“œ์ฝ”๋”ฉ ๋˜์–ด์žˆ์–ด์•ผ ํ•จ

 

์˜ˆ์‹œ)

android {
    signingConfigs {
        debug {
            keyAlias 'android-debug-key'
            keyPassword 'password0000'
            storePassword 'password0000'
            storeFile file('../debug.keystore')
        }
        release {
            keyAlias 'android-release-key'
            keyPassword 'password1111'
            storePassword 'password1111'
            storeFile file('../release.keystore')
        }
    }
    
    buildTypes {
        release {
            signingConfig signingConfigs.release
        }
        debug {
            signingConfig signingConfigs.debug
        }
    }
}

 

 

 

728x90
๋ฐ˜์‘ํ˜•