谷歌地图显示灰色
我知道这已被问过,但我已阅读/测试了几个小时,我无法让我的地图出现!我生成了md5并注册了它,它给了我在下面的代码中使用的密钥。请帮忙!!!!!! 这里是AndroidManifest.xml中:谷歌地图显示灰色
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.libertytech.locatemycar"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<uses-library android:name="com.google.android.maps" />
<activity android:name=".Home"
android:label="@string/app_name"
android:configChanges="orientation|keyboardHidden|keyboard">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.libertytech.locatemycar.GoogleMap" android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar"
android:configChanges="orientation|keyboardHidden|keyboard">
</activity>
<activity android:name="com.libertytech.locatemycar.Test" android:label="@string/app_name"
>
</activity>
</application>
<uses-permission android:name="android.permission.Internet"/>
<uses-permission android:name="android.permission.ACCESS_COURSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-sdk android:minSdkVersion="7" />
</manifest>
这里是googlemaps.xml
<com.google.android.maps.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:apiKey="006_T_R2vy70wILMHcCnAGiZoOe7jVjYM_xYtXA"
/>
所有所需的XML标签似乎是在正确的位置。我在手机上有互联网(我可以浏览网页)。我错过了什么?
我会提供一个检查清单。请确保这些事情被正确地遵守。使用
- 构建目标平台:它应该是谷歌API的
- 模拟器:你应该使用谷歌的目标的模拟器不Android系统。
- MD5键:它应该从您编译应用程序的同一台机器生成。 也跟着如何获得在这个环节中详述的应用程序的MapView:http://mobiforge.com/developing/story/using-google-maps-android
为了让应用程序在模拟器中工作,然后使用从调试密钥库生成是OK的API密钥密钥。
要在手机上运行应用程序,您需要一个不同的Google API密钥;这必须从您有明确的私人密钥库生成签署。
看到此链接Signing Your Applications 的细节
我不会将其发布到应用商店。我将USB线连接到我的电脑和手机,并将应用程序部署到手机中。我已阅读你提供的链接,我不认为这是问题。我正在使用Eclipse,Eclipse默认使用该调试。 – Luke 2011-05-21 21:37:56
Eclipse默认使用调试密钥,但您仍然需要获取Google为该调试密钥提供的密钥。没有它,无论你只是为了自己而尝试它,它都不会工作。它们是不同的东西,您需要与调试密钥关联的映射密钥。 – ferostar 2011-05-21 22:30:56
这是从调试密钥库生成的MD5密钥:CF:ED:24:FA:81:28:CA:EF:E6:8A:A6:23:46:98:46:1F然后我去Google注册页面并用它来获取API key 006_T_R2vy70wILMHcCnAGiZoOe7jVjYM_xYtXA。这是上例中的关键。你是要求我做一些不同的事情还是除了我已经做过的事之外? – Luke 2011-05-21 23:28:41
第1原来,我需要使用android.permission.INTERNET
不android.permission.Internet
!如果Google可能提供了关于缺少权限或有用的错误,那就太好了。这将节省我几个小时的工作!
1)我确实设置了构建目标。我有“谷歌API”检查api级别7也是minSdkVersion。如果没有设置,应用程序甚至不会启动。 2)我没有使用模拟器我正在使用HTC Incredible。 3)我正在编译的同一台机器上生成MD5密钥。 – Luke 2011-05-21 20:58:03