Google Maps APIv2身份验证失败

时间:2013-08-15 16:18:30

标签: android google-maps authentication key

错误:

08-15 12:59:17.435: E/Google Maps Android API(14665): Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors).

Google控制台:

google console

清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.cefetmgrdctcc.sgtp"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="18" />

    <permission
        android:name="com.cefetmgrdctcc.sgtp.permission.MAPS_RECEIVE"
        android:protectionLevel="signature"/>

    <uses-permission android:name="com.cefetmgrdctcc.sgtp.permission.MAPS_RECEIVE"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true"/>    

    <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.maps.v2.API_KEY"
            android:value="Hidden key"/>
        <activity
            android:name="com.cefetmgrdctcc.sgtp.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

地图控件的布局:

<fragment
    android:id="@+id/googlemap"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    class="com.google.android.gms.maps.SupportMapFragment" />

我已将Google Play服务导入我的项目,并在Google API控制台服务列表“Google Maps API v2”,“Google Maps API v3”和“Google Maps Android API v2”上进行了标记,但它似乎是我的地图片段仍然无法进行身份验证。

地图片段只是屏幕中间的一个空白灰色方块,任何想法为什么会发生这种情况?

3 个答案:

答案 0 :(得分:17)

嗨,我只是遇到了同样的问题。我尝试了文档所说的所有内容,但似乎没有任何效果。

对我来说唯一有用的是卸载并重新安装我的应用程序(甚至没有重新启动工作),因为显然如果你在配置上犯了一个错误,系统会缓存失败的身份验证,即使在修复配置后你的地图也不会工作

请尝试按照有关在Android上配置Google Maps Api的文档和指南,但每次更改配置卸载并重新安装时都会这样做。

答案 1 :(得分:1)

如果您在设备上运行应用程序,遇到同样的问题,并且没有运气任何其他解决方案。

检查其他应用程序是否依赖于Play Play等谷歌播放服务正在工作。如果他们在连接服务器时遇到问题(&#34;无连接,重试&#34;)即使互联网连接可用,以上几点可能是解决方案。

答案 2 :(得分:0)

我重新生成了API密钥,并在谷歌控制台中更新,工作正常

相关问题