谷歌地图APIv2验证失败地图

2023-09-06 04:17:16 作者:因拽而被判死刑。

错误:

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).

在谷歌控制台:

The 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>

地图控件的布局:

The layout of the map control:

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

我已经导入了谷歌播放服务到我的项目,标志着谷歌API控制台服务列表谷歌地图API V2,谷歌地图API第3版和谷歌地图Android的API V2上,但它似乎我的地图片段仍然不能够进行验证。

I've imported the Google Play Services into my project and marked on the Google API Console Services list "Google Maps API v2", "Google Maps API v3" and "Google Maps Android API v2", however it seems my Map Fragment is still not being able to authenticate.

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

Map Fragment is just a blank grey square on the middle of the screen, any ideas why is this happening?

推荐答案

您好我只是有这个完全一样的问题。我什么都试过该文档称,但似乎没有任何工作。

Hi I was just having this exact same problem. I tried everything the docs said but nothing seemed to work.

这是为我工作的唯一的事情是卸载并重新安装我的应用程序(甚至没有重启过),因为很明显,如果你犯一个错误的配置系统缓存无法通过认证,你的地图将不会修复您的配置之后,甚至工作

The only thing that worked for me was uninstalling and reinstalling my application (not even rebooting worked) because apparently if you make one mistake on the configuration the system caches the failed authentication and your maps won't work even after fixing your configuration.

因此​​,尝试下面的文档和导向器在Android上,但配置谷歌地图API每次你改变一些东西在你的配置卸载并重新安装的时间。

So try following the docs and guides on configuring Google Maps Api on Android but every time you change something on your configuration uninstall and reinstall.