我使用了调试密钥,我的应用程序运行得很好但是当我生成自己的api密钥时,我的谷歌地图只是在铺设灰色瓷砖。这是我的xml文件
<?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 :(得分:1)
您必须在使用自己的API密钥时使用密钥库对应用程序进行签名,而不是使用调试密钥库。
如果您尚未完成此过程,最简单的方法是通过 Eclipse (使用GUI)
答案 1 :(得分:1)
尝试放
<category android:name="android.intent.category.EMBED"/>
在地图活动中。
如果这不起作用,请尝试删除背景...
答案 2 :(得分:1)
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
。
答案 3 :(得分:1)
对于遇到困难的每个人,我在使用旧应用程序时遇到此问题。我尝试生成map-api level 2和api level 3 key而没有任何运气(尝试了所有的提示)。
当我切换到API级别1键时,我能够使其正常工作。
答案 4 :(得分:1)
debug
的API密钥仅适用于模拟器。
如果您使用Eclipse将debug mode
中的软件加载到手机中,您将获得磁贴,而不是地图。
release
API密钥更新mapview,请使用Eclipse
EXPORT
创建一个apk文件。