繁体   English   中英

Google Maps APIv2身份验证失败

[英]Google Maps APIv2 Authentication failure

错误:

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控制台:

谷歌控制台

清单:

<?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”中进行了标记,但似乎我的地图片段仍然是无法进行身份验证。

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

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

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

因此,请尝试按照有关在Android上配置Google Maps Api的文档和指南进行操作,但每次更改配置卸载并重新安装时。

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

检查其他应用程序是否依赖于Play Play等谷歌播放服务正在工作。如果连接到服务器时出现问题(“无连接,重试”),即使可以使用互联网连接,上述点之一也可能是解决方案。

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM