2013-08-07 36 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工作的开发手机。因此,我建议大家尝试创建地图的片段方式,如果你得到这个错误,无法修复它。