加載谷歌地圖的Android API V2,當我得到這個下面的錯誤無法加載地圖使用谷歌地圖的Android API V2
1. Authorization failure.
2. Ensure that the following correspond to what is in the API Console: Package Name: com.example, API Key: AIzaSyDjm0K-ucpO5mDCPPnQ4CzVpdguqM714uo, Certificate Fingerprint: D9595FF0F329A6BBAC466C63284F83D17859894B
3. Failed to contact Google servers. Another attempt will be made when connectivity is established.
4. Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors).
5. Failed to find provider info for com.google.android.gsf.gservices
這裏是我的源代碼:
我AndroidManifest源代碼
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" package="com.example">
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="14" />
<application android:label="map" android:icon="@drawable/Icon">
<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="AIzaSyDjm0K-ucpO5mDCPPnQ4CzVpdguqM714uo" />
</application>
<permission android:name="com.example.permission.MAPS_RECEIVE" android:protectionLevel="signature" />
<uses-permission android:name="com.example.permission.MAPS_RECEIVE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<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" />
<uses-permission android:name="android.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
</manifest>
我Main.axml源代碼
Main.axml
<?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"
class="com.google.android.gms.maps.MapFragment" />
我的活性1源代碼
Activity1.cs
using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
namespace map
{
[Activity(Label = "map", MainLauncher = true, Icon = "@drawable/icon")]
public class Activity1 : Activity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Main);
}
}
}
順便說一句,我使用API Level 15模擬器。
這是我的API密鑰
爲什麼標記爲C#? – Raghunandan
錯誤信息在哪裏? – Jagan
發佈錯誤消息以及您的佈局,我們可以幫助您解決這個問題。 – Fllo