App cannot connect to Google servers for access to Google maps

匿名 (未验证) 提交于 2019-12-03 09:18:39

问题:

I've been working on an android app for the past little while and I wanted to set it up to connect to Google Maps. I've been writing it inside Eclipse with the ADT plugins. I followed this tutorial but I've been getting the following Error when I try to load maps.

"failed to load map. error contacting google servers. this is probably an authentication issue (but could be do to network errors)"

Since I can access google maps in other apps it has to be an authentication error. I've tried uninstalling the app from my phone but that does not fix the error.

The SHA1 that eclipse is using (according to window > properties > android > build) is 58:EF:6F:DE:DE:B4:4E:EB:20:15:68:39:08:5D:87:32:FE:20:99:99

I used this to generate an API key in the google console which you can see contained below in my manifest file. The app I specified in the console was 58:EF:6F:DE:DE:B4:4E:EB:20:15:68:39:08:5D:87:32:FE:20:99:99;com.example.test. It may be worth noting that I'm loading the map inside an activity located in the gui package, not the com.example.test package that contains MainActivity.

I've been testing this on my nexus 5 by clicking play in eclipse while the phone is plugged into my computer.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"     package="com.example.test"     android:versionCode="1"     android:versionName="1.0" >  <uses-sdk     android:minSdkVersion="18"     android:targetSdkVersion="19" />  <uses-feature     android:glEsVersion="0x00020000"     android:required="true" />  <permission     android:name="com.example.test.permission.MAPS_RECEIVE"     android:protectionLevel="signature" />   <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />  <application     android:allowBackup="true"     android:icon="@drawable/ic_launcher"     android:label="@string/app_name"     android:theme="@style/AppTheme" >     <meta-data         android:name="com.google.android.gms.version"         android:value="@integer/google_play_services_version" />     <meta-data         android:name="com.google.android.maps.v2.API_KEY"         android:value="AIzaSyBsTBliiyhE2G4Navzfc1ANeI9f7JwAtEM" />      <activity         android:name="com.example.test.MainActivity"         android:label="@string/app_name" >     </activity>     <activity         android:name="gui.SetLocationActivity"         android:label="@string/title_activity_set_location" >     </activity> </manifest> 
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!