我仍然无法将我的地图显示在我的设备上 我刚刚用Android studio创建了一个新的地图活动,并按照屏幕上的指示但仍然得到了同样的错误。 我没有触及所有的mapActivity.java
- update-- 当我开始一个新项目时,同样的事情发生了
AndroidManifest.xml(我试图用V2替换gms但仍然没有)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.ofir.bopofinal">
<!-- google maps permission -->
<!-- Required -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<permission
android:name="com.example.ofir.bopofinal.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.ofir.bopofinal.permission.MAPS_RECEIVE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<!-- Optional -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat.DayNight">
<activity android:name=".CreateNewEvent.CreateNewEventActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".LoginRegister.RegisterActivity" />
<activity android:name=".LoginRegister.LoginActivity" />
<activity android:name=".Categories.SuggestCategoryActivity" />
<activity android:name=".MainAppScreenActivity" />
<!--
The API key for Google Maps-based APIs is defined as a string resource.
(See the file "res/values/google_maps_api.xml").
Note that the API key is linked to the encryption key used to sign the APK.
You need a different API key for each encryption key, including the release key that is used to
sign the APK for publishing.
You can define the keys for the debug and release targets in src/debug/ and src/release/.
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
<meta-data android:name="com.google.android.gms.vision"
android:value="@integer/google_play_services_version"/>
<activity
android:name=".CreateNewEvent.MapsActivity"
android:label="@string/title_activity_maps">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.ofir.bopofinal.CreateNewEvent.CreateNewEventActivity" />
</activity>
</application>
</manifest>
12-08 13:30:36.283 17880-18426/com.example.ofir.bopofinal E/b: Authentication failed on the server.
12-08 13:30:36.283 17880-18426/com.example.ofir.bopofinal E/Google Maps Android API: Authorization failure. Please see https://developers.google.com/maps/documentation/android-api/start for how to correctly set up the map.
12-08 13:30:36.286 17880-18426/com.example.ofir.bopofinal E/Google Maps Android API: In the Google Developer Console (https://console.developers.google.com)
Ensure that the "Google Maps Android API v2" is enabled.
Ensure that the following Android Key exists:
API Key: AIzaSyBlUuFCU_rpmxVq8x0V5KzFugnM6Yo43Uw
Android Application (<cert_fingerprint>;<package_name>): A8:A2:BE:67:AA:2F:C6:A2:BA:40:58:C9:D7:41:38:D0:98:B6:DA:42;com.example.ofir.bopofinal
12-08 13:30:37.813 17880-18420/com.example.ofir.bopofinal W/DynamiteModule: Local module descriptor class for com.google.android.gms.googlecertificates not found.
12-08 13:30:37.823 17880-18420/com.example.ofir.bopofinal I/DynamiteModule: Considering local module com.google.android.gms.googlecertificates:0 and remote module com.google.android.gms.googlecertificates:2
12-08 13:30:37.823 17880-18420/com.example.ofir.bopofinal I/DynamiteModule: Selected remote version of com.google.android.gms.googlecertificates, version >= 2
12-08 13:30:37.873 17880-18420/com.example.ofir.bopofinal W/System: ClassLoader referenced unknown path: /data/user/0/com.google.android.gms/app_chimera/m/00000011/n/armeabi
答案 0 :(得分:1)
您必须在生成的 res / values / google_maps_api.xml
中定义Google地图APi密钥请参阅此链接以创建Map Api Key并按照提到的简单步骤操作 https://developers.google.com/maps/documentation/android-api/signup
答案 1 :(得分:1)
您是否已使用自己的软件包名称配置了api,可以看到如何here
因为你的错误是关于谷歌开发者控制台上的api密钥。