谷歌地图Api键给灰色瓷砖

问题描述:

我用调试键和我的应用程序工作得很好,但是当我生成我自己的api键时,我的谷歌地图只是用灰色的瓷砖铺平。这里是我的xml文件谷歌地图Api键给灰色瓷砖

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@drawable/bg" > 

<com.google.android.maps.MapView 
    android:id="@+id/mapView" 
    android:layout_width="fill_parent" 
    android:layout_height="400px" 
    android:layout_alignParentTop="true" 
    android:layout_marginTop="20px" 
    android:apiKey="0FngR799edZTGCRHpFXeNAlq6bB8LjrNCFAyPPg" 
    android:clickable="true" 
    android:enabled="true" /> 

我所做的一切都是正确的,让我的API密钥我甚至有两个不同的密钥库,尝试了两次,复制和粘贴MD5指纹......这里是我的清单

<?xml version="1.0" encoding="utf-8"?> 
    <manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="unjustentertainment.mything.com" 
android:versionCode="1" 
android:versionName="1.0" > 

<uses-sdk android:minSdkVersion="4" /> 

<uses-permission android:name="android.permission.INTERNET" /> 
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> 
<application 
    android:icon="@drawable/ic_launcher" 
    android:label="@string/app_name" > 


    <activity 
     android:label="@string/app_name" 
     android:name=".MyThingsActivity" 
     android:theme="@android:style/Theme.NoTitleBar" > 
     <intent-filter > 
      <action android:name="android.intent.action.MAIN" /> 

      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 
    <activity android:name=".Items" 
        android:label="@string/app_name" 
        android:theme="@android:style/Theme.NoTitleBar"> 
        <intent-filter > 
      <action android:name="unjustentertainment.mything.com.CLEARSCREEN" /> 

      <category android:name="android.intent.category.DEFAULT" /> 
     </intent-filter> 

     </activity> 

     <activity android:theme="@android:style/Theme.NoTitleBar" 
        android:name=".Data" 
        android:label="@string/app_name" 

        /> 

      <activity 
     android:screenOrientation="portrait" 
     android:name="com.google.ads.AdActivity" 
      android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" 
      /> 


       <uses-library android:name="com.google.android.maps"/> 
</application> 



    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> 

我只是不知道为什么非我的API键工作。任何想法都有帮助。谢谢我也已经签署了我的包

+0

你与你的发展的关键签名,然后tryed运行呢?如果这不起作用,请尝试重新获取密钥,有时会发生改变(想想如果它被错误来源调用了太多次)。 – Warpzit 2011-12-15 08:17:29

您必须在使用自己的API密钥而不是调试密钥库的情况下使用密钥库对应用程序进行签名。

如果你还没有经历了这个过程,最简单的方法就是通过的Eclipse(带GUI)的项目

  • 点击鼠标右键。
  • 转到Android工具。
  • 导出签名的应用程序。
+0

是啊,我已经做到了这就是我得到了我的密钥存储在首位 – 2011-12-15 02:37:54

+0

仍然没有工作 – 2011-12-15 02:43:37

尽量把

<category android:name="android.intent.category.EMBED"/> 

里面的地图活动。

如果这不起作用,尽量去除化背景...

  • 如果用调试密钥签名 - >使用调试apiKey的地图。
  • 如果您使用自己的密钥签名 - >生成自己的apiKey。

That should be all; you can generate the API key here.

Go to this link for more info regarding the same.

你的关键的MD5 value不要粘贴到您的布局apiKey = attribute

对于每个遇到问题的人,我都遇到了一个旧版应用程序的问题。我尝试生成一个没有任何运气的map-api level 2和api level 3 key(尝试了这里的所有提示)。

当我切换到API级别1密钥时,我能够正常工作。

debug的API密钥只适用于仿真器。

如果您使用Eclipse将debug mode中的软件加载到手机,您将获得切片,而不是地图。

  • 如果更新了release API密钥的MapView,然后使用Eclipse EXPORT创建一个apk文件。
  • 将其复制到手机上的SD卡上。
  • 然后使用一个安装程序(下载谷歌从自由发挥),以它的工作原理手机上安装 它!