๐๊ตฌ๊ธ ์ง๋ ํ๋ก์ ํธ ๋ง๋ค๊ธฐ
์ฌ๊ธฐ ์ฐธ์กฐํด์ ๋ง๋ค์๋ค! ๊ฐ์ฅ ์ต์ ๋ฒ์
https://developers.google.com/maps/documentation/android-sdk/start?hl=ko#api-key
Android์ฉ Maps SDK ๋น ๋ฅธ ์์ | Google Developers
์ง๊ธ ๋ฐ๋ก Android ์ฑ์ฉ Google ์ง๋ ํ๋ก์ ํธ๋ฅผ ์์ํด ๋ณด์ธ์. SDK ์ค์น๋ถํฐ ์ฑ ๋น๋ ๋ฐ ์คํ์ ์ด๋ฅด๊ธฐ๊น์ง ํ์ํ ๋ชจ๋ ๊ฒ์ ์ฐพ๋ ๋ฐฉ๋ฒ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
developers.google.com
New Project ์ฐฝ์ GoogleMapsActivity๋ฅผ ์ ํํ๊ณ next
ํ๋ก์ ํธ ์์ฑํ๊ธฐ
ํ๋ก์ ํธ ๋ง๋ค๊ธฐ
Google Cloud Platform
ํ๋์ ๊ณ์ ์ผ๋ก ๋ชจ๋ Google ์๋น์ค๋ฅผ Google Cloud Platform์ ์ฌ์ฉํ๋ ค๋ฉด ๋ก๊ทธ์ธํ์ธ์.
accounts.google.com
build.gradle(project) ํ์ผ์ ์ถ๊ฐ
buildscript {
dependencies {
// ...
classpath "com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin:2.0.0"
}
}
build.gradle(app)์ ์ถ๊ฐ
id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'
local.properties์ ๋ค์ด๊ฐ์
MAPS_API_KEY=YOUR_API_KEY
์ด์ํ์์ ์คํํ๋ฉด ์ด๋ ๊ฒ ๋นํ๋ฉด์ด ๋์จ๋ค! API๋ฑ๋ก์ด ์ ๋๋ก ์๋๋ฉด ์ด๋ฐ์์ผ๋ก ํ๋ฉด์ด ๋์จ๋ค!
API ํค๋ก ๋ณ๊ฒฝํ๋ค
์ฌ๊ธฐ์ apiํค๋ฅผ ๋ฐ์ ์ ์๋ค
์ฌ์ฉ์ ์ธ์ฆ์ ๋ณด -> ์ฌ์ฉ์ ์ธ์ฆ์ ๋ณด ๋ง๋ค๊ธฐ
google_maps.api.xml์์ ์๋ SHAํค์ ํจํค์ง ์ด๋ฆ์ ์ ๋ ฅํ๋ค!
google_maps_api.xml์์ ๋น๋ฒ์ ๋ฃ๋๋ค
Mainifest์๋ ๊ถํ ์ถ๊ฐ
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
bulild.gradle์
dependencies {
implementation 'com.google.android.gms:play-services-maps:18.0.1'
// ...
}
API ํค ์ ๋ฑ๋กํ๋ฉด ์ด๋ฐ์์ผ๋ก ํ๋ฉด์ด ์๋์จ๋ค~
'๊ธฐํ > Android' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Android] ์๋ฎฌ๋ ์ดํฐ AVD ๋จนํต์ผ๋ (0) | 2022.03.16 |
---|---|
[AndroidStudio/์๋๋ก์ด๋์คํ๋์ค] .gitignore ์ค์ ํ๊ธฐ (0) | 2022.03.15 |
[Android] ์นด์นด์คํก ๋ก๊ทธ์ธ API ๊ตฌํํ๊ธฐ (0) | 2022.03.10 |
[Android/ Kotlin ์ค๋ฅ] Kotlin-DataBinding-Error: Check your module classpath for missing or conflicting dependencies (0) | 2022.03.10 |
[Android] ImageView ๊ฝ์ฐจ๊ฒ(scaleType) (0) | 2022.03.10 |