Google Maps api v2授权失败错误

时间:2015-01-28 14:52:00

标签: android google-maps authentication

我是编程新手,我正在尝试使用示例项目在应用程序上添加地图(https://developers.google.com/maps/documentation/android/start#get_an_android_certificate_and_the_google_maps_api_key)。 我收到这个错误:

> 4056-4256/com.example.michele.positioncontroller E/Google Maps Android
> API﹕ Authorization failure.  Please see
> https://developers.google.com/maps/documentation/android/start for how
> to correctly set up the map.
> 4056-4256/com.example.michele.positioncontroller 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: AIzaSyXXXXXXXXXXXXXXXXXXXXXXXXXcxdlzFLU
> 
>     **Android Application (<cert_fingerprint>;<package_name>): 17:FBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXC6:47;com.example.michele.positioncontroller**

我阅读了很多有关此论点的主题,并且我已经制定了添加Google Maps Android API v2的所有程序,但我认为主要问题是logcat中的Android应用程序指纹与Google API控制台上的指纹不同。这是我在Google API控制台上的关键:

Android应用的密钥(带证书)

API密钥:
AIzaSyBe0fZJJns-cu8xLQv294GMGM4cxdlzFLU

Android应用:
44:E3XXXXXXXXXXXXXXXXXXXXXXXXXXXX8F:3E; com.example.michele.positionController

这是我的清单:

<?xml version="1.0" encoding="utf-8"?>

<permission android:name="com.example.michele.positionController.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
<uses-permission android:name="com.example.michele.positionController.permission.MAPS_RECEIVE"/>
<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-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

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

    <activity
        android:name=".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>

    <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="AIzaSyBe0fZJJns-cu8xLQv294GMGM4cxdlzFLU"/>


</application>

这是我的activity_main.java:

package com.example.michele.positionController;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.app.Activity;


public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}

这是我的activity_main.xml:

    <?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/map"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:name="com.google.android.gms.maps.MapFragment"/>

非常感谢!

0 个答案:

没有答案