-
카테고리
-
세부 분야
모바일 앱 개발
-
해결 여부
미해결
구글맵강의중에서 ..
24.02.09 13:40 작성 24.02.09 14:00 수정 조회수 192
0
설날을 맞이하신 강사님 새해에도
늘 건강하시고 부자되세요 ^^
프로젝트폴더에서 New >> Fragment >> Google Map Fragment 를 선택하고 Fragment Name 을 MapsFragment 로 해서 Finish 버튼을 누르면
프로젝트폴더내에 MapsFragment.kt 파일과
res/layout 폴더내에 fragment_maps.xml 파일은 생성이 되나
res/values 폴더내에 google_maps_api.xml 파일은 생성되지 않습니다
그리고 관련파일들을 실행하여도 오류는 없으나
구글맵이 나타나지 않고 빈화면만 뜹니다
git 에 파일들을 올려두었습니다
https://github.com/dongguntechnology/GoogleMap
답변을 작성해보세요.
0
shafeel2
질문자2024.02.17
실제 제 휴대폰에 연결해 실행해 보니
GoogleMap 이 계속중단됨
이라는 경고창이 뜨네요
혹시 저의 api 키에 문제가 있는것 같습니다
0
0
shafeel2
질문자2024.02.10
일러주신대로 AndroidManifest.xml 파일을 수정하여도 여전히 화면에 맵이 뜨지를 않고 빈화면만 뜨는군요 ...
제실수 앞전에 올려드린 git 주소는 private 여서 접속이 않된것 같습니다 죄송합니다
아래의 새로운 public 주소로 파일을 올려두겠습니다
https://github.com/dongguntechnology/googlemap2
오준석
지식공유자2024.02.10
공유해 주신 코드에 제 API 키를 넣어서 바로 실행했을 때 지도가 잘 표시됩니다.
키 설정에 문제가 있을 가능성이 있습니다.
GCP 콘솔에서 키 제한사항을 없음으로 설정하고 해 보시겠어요?
만약 잘 된다면 제한사항을 Android 앱으로 했을 때의 설정 중에 패키지 이름이나 Sha1 지문이 잘못 입력 된 것이 아닐까 의심됩니다.
0
shafeel2
질문자2024.02.09
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIz$%^&**(-0" />
위와 같이 해도 여전히 빈화면만 뜨네요 ...
https://github.com/dongguntechnology/GoogleMap
0
shafeel2
질문자2024.02.09
제컴 안드로이드스튜디오내 API key 가 저장된
res/values/strings.xml 파일내용입니다
<resources>
<string name="app_name">GoogleMap</string>
<string name="goodle_map_api_key">AI%^&&%$#$&*-0</string>
</resources>
0
shafeel2
질문자2024.02.09
제컴의 AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.GoogleMap"
tools:targetApi="31">
<!--
TODO: Before you run your application, you need a Google Maps API key.
To get one, follow the directions here:
https://developers.google.com/maps/documentation/android-sdk/get-api-key
Once you have your API key (it starts with "AIza"), define a new property in your
project's local.properties file (e.g. MAPS_API_KEY=Aiza...), and replace the
"YOUR_API_KEY" string in this file with "${MAPS_API_KEY}".
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/goodle_map_api_key" />
<activity
android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.GoogleMap">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
오준석
지식공유자2024.02.09
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="여기에 넣으세요" />
<activity
이 부분에 API_KEY 값을 넣으시면 됩니다.
0
오준석
지식공유자2024.02.09
공유해 주신 github 링크는 보이지 않아서 일단 제가 새 프로젝트로 MapsFragment 를 추가해 보았습니다.
말씀하신대로 지금은 google_maps_api.xml 은 생성되지 않네요. 대신 AndroidManifest.xml에 API 를 넣으시면 될 것 같습니다.
답변 7