Google๊ณผ ์—ฐ๋™ํ•˜์—ฌ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•˜๋ ค๋ฉด ํฌ๊ฒŒ ๋‘๊ฐ€์ง€ ๊ณผ์ •์ด ํ•„์š”ํ•˜๋‹ค.


1. Debugging sign ๊ตฌํ•˜๊ธฐ

2. app ๋‚ด์— google์ด ์ œ๊ณตํ•˜๋Š” google-services.json ํŒŒ์ผ ๋„ฃ๊ธฐ


(google service๋ฅผ ์‚ฌ์šฉํ•จ์— ์žˆ์–ด ์ด ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์ด ์ง„์งœ๋กœ ์„œ๋น„์Šค๋ฅผ ์ œ๊ณตํ•ด๋„ ๋  ์ง€ ์—ฌ๋ถ€๋ฅผ ํ™•์ธํ•˜๋Š” ์šฉ๋„)

 

๋จผ์ €, Android studio ์—์„œ SHA1 ๋ฅผ ์–ป์–ด๋ณด์ž.

1. View - Tool Windows - Gradle ์„ ํด๋ฆญํ•˜๋ฉด Android studio์˜ ์˜ค๋ฅธํŽธ์— Gradle ์ฐฝ์ด ๋œจ๊ฒŒ ๋œ๋‹ค.

2. [package name] - app - android ์— ๋“ค์–ด๊ฐ€๋ฉด signingReport๋ผ๊ณ  ์žˆ๋Š”๋ฐ ์ด๊ฑธ ์‹คํ–‰์‹œ์ผœ ์ค€๋‹ค.

 

3. debug ์šฉ SHA1๊ฐ€ ์•„๋ž˜์™€ ๊ฐ™์ด ํ‘œ์ถœ๋œ๋‹ค.

4. google-services.json ์„ ๋‹ค์šด๋ฐ›์•„ app ํด๋” ์•„๋ž˜์— ๋ณต์‚ฌํ•ด์„œ ๋„ฃ๋Š”๋‹ค.

5. ๋งŒ์•ฝ build.gradle์— ์•„๋ž˜ ๋‚ด์šฉ์ด ์—†๋‹ค๋ฉด, ๋ฐ˜๋“œ์‹œ ์ž…๋ ฅ ํ›„ sync๋ฅผ ํ•ด์•ผ ํ•œ๋‹ค.

๊ทธ๋ ‡์ง€ ์•Š์œผ๋ฉด FirebaseApp.initializeApp(context)๊ฐ€ ์™„๋ฃŒ๋˜์ง€ ์•Š์•˜๋‹ค๊ณ  ๊ฒฝ๊ณ  ๋ฉ”์„ธ์ง€๊ฐ€ ๋œจ๋ฉด์„œ ์‹คํ–‰์ด ๋˜์ง€ ์•Š์„ ๊ฒƒ์ด๋‹ค.

- project level build.gradle

buildscript {
    ...
    }
    dependencies {
		...
        classpath "com.google.gms:google-services:4.3.5"
    }
}

- module level build.gradle

plugins {
    ...
    id 'com.google.gms.google-services'
}

...

dependencies {
    implementation platform('com.google.firebase:firebase-bom:26.5.0')
    implementation 'com.google.firebase:firebase-auth-ktx'
}

+ Recent posts