2013-08-07 41 views
3

所以我一直在試圖處理這個GreyGridOfDoom™過去兩天沒有結果。我已閱讀了數十篇SO帖子,並跳過了至少一百個關於該主題的Google搜索結果。適用於Android Xamarin/C#的Google API密鑰。地圖只顯示灰色網格

到目前爲止故事:

  • 我已經從谷歌API來訪問網站了Android API密鑰。
  • 我可以得到GGOD但沒有地圖數據。縮放鍵等等工作得很好。
  • 到目前爲止,我已嘗試過15種不同的解決方案。
  • 我已經使用不同的GOOGLE API版本製作了幾個AVD,但沒有任何一個可以有任何不同。爲了準確,我嘗試了8-14。
  • 在日誌「[MapActivity]無法獲得連接工廠客戶端」是所有地獄崩潰的地步。
  • 我正在使用MapActivity和最新的Google Play服務。
  • 我的密鑰是使用.android文件夾中的debug.keystore生成的。

所以是的。我有一個直覺,我有一個糟糕的API密鑰,但我真的不確定。

我的繼承人相關代碼:

MapsActivity.cs

using System; 
    using System.Collections.Generic; 
    using System.Linq; 
    using System.Text; 

    using Android.Support.V4.App; 
    using Android.App; 
    using Android.Content; 
    using Android.OS; 
    using Android.Runtime; 
    using Android.Views; 
    using Android.Widget; 
    using Android.GoogleMaps; 

    namespace IgluHarkka2 
    { 
     [Activity (Label = "MapsActivity", MainLauncher = true)]    
     public class MapsActivity : MapActivity 
     { 
      protected override void OnCreate(Bundle bundle) 
      { 
       base.OnCreate(bundle); 
       SetContentView(Resource.Layout.Map); 
       MapView mapView = (MapView) FindViewById(Resource.Id.mapView); 
       mapView.SetBuiltInZoomControls (true); 
      } 

      protected override bool IsRouteDisplayed 
      { 
       get {return false;} 
      } 
     } 
    } 

Map.xml

<?xml version="1.0" encoding="utf-8"?> 
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent"> 
     <com.google.android.maps.MapView 
      android:id="@+id/mapView" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:enabled="true" 
      android:clickable="true" 
      android:apiKey="XXXXXXXXXX" /> 
    </RelativeLayout> 

AndroidManifest.xml中

<?xml version="1.0" encoding="utf-8"?> 
    <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="IgluHarkka2.IgluHarkka2"> 
       <uses-sdk android:minSdkVersion="7" /> 
      <application android:label="IgluHarkka2"> 
       <uses-library android:name="com.google.android.maps" /> 
      </application> 
       <permission android:name="com.IgluHarkka2.IgluHarkka2.permission.MAPS_RECEIVE" android:protectionLevel="signature"/> 

       <uses-permission android:name="android.permission.INTERNET" /> 
       <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /> 
       <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 
       <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
       <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" /> 
     </manifest> 

這裏我基本上會猿關於親瑕疵和只是垃圾郵件的名稱,看看是否是這個問題... Api Access screenshot

所以,如果任何人都可以解決這個問題,我會非常活着最幸福的人。由於目前我還沒有解決方案,現在我會刷新這個頁面。我實在不明白這一點:<

編輯: 更多信息:

應用輸出模擬器的

Forwarding debugger port 8897 
    Forwarding console port 8898 
    Detecting existing process 
    [monodroid-gc] GREF GC Threshold: 1800 
    Loaded assembly: IgluHarkka2.dll 
    Loaded assembly: GooglePlayServicesLib.dll [External] 
    Loaded assembly: Newtonsoft.Json.dll [External] 
    Loaded assembly: Mono.Android.GoogleMaps.dll [External] 
    Loaded assembly: Mono.Android.dll [External] 
    [MonoDroid] Xamarin/Android Trial Mode Active 
    [dalvikvm-heap] Grow heap (frag case) to 7.236MB for 441776-byte allocation 
    [gralloc_goldfish] Emulator without GPU emulation detected. 
    Loaded assembly: System.Core.dll [External] 
    Loaded assembly: MonoDroidConstructors [External] 
    [CursorWrapperInner] Cursor finalized without prior close() 
    [CursorWrapperInner] Cursor finalized without prior close() 
    [MapActivity] Handling network change notification:CONNECTED 
    [MapActivity] Couldn't get connection factory client 
    [System.err] IOException processing: 26 
    [System.err] java.io.IOException: Server returned: 3 
    [System.err] at android_maps_conflict_avoidance.com.google.googlenav.map.BaseTileRequest.readResponseData(BaseTileRequest.java:115) 
    [System.err] at android_maps_conflict_avoidance.com.google.googlenav.map.MapService$MapTileRequest.readResponseData(MapService.java:1473) 
    [System.err] at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.processDataRequest(DataRequestDispatcher.java:1117) 
    [System.err] at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.serviceRequests(DataRequestDispatcher.java:994) 
    [System.err] at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher$DispatcherServer.run(DataRequestDispatcher.java:1702) 
    [System.err] at java.lang.Thread.run(Thread.java:856) 

截圖: Screenshot

+0

您是否檢查http://stackoverflow.com/questions/7296467/google-map-signed-api-key-errors-in-android?聽起來像是你的錯誤。 –

+0

是的。問題是我沒有使用Eclipse,我已經使用了debug.keystore。所以我不認爲這個帖子真的適用於這裏。 – Tibelius

+0

我應該以某種方式生成一個新的debug.keystore並使用新的SHA1指紋來創建一個新的API密鑰?如果是這樣,我不確定如何用Xamarin獲得新的密鑰庫。 – Tibelius

回答

1

從MapActivity變爲FragmentActivity後我得到了這個錯誤。然後我遇到了另一個錯誤,聲稱我的項目沒有/找不到Google Play服務。在這一刻我開始懷疑,如果模擬器是原因,所以我嘗試將新版本部署到我們在辦公室和BOOM工作的開發手機。因此,我建議大家嘗試創建地圖的片段方式,如果你得到這個錯誤,無法修復它。