2011-03-23 153 views
0

我试图让GoogleMaps显示在模拟器或我的Android设备上。无法让GoogleMaps在Android上显示

我已经经历了一切关于这个在互联网上,有没有运气

布局 - main.xml中有apiKey我debug.keystore

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent"> 
<TextView 
    android:id="@+id/myLocationText" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/hello" 
/> 
<com.google.android.maps.MapView 
    android:id="@+id/myMapView" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:enabled="true" 
    android:clickable="true" 
    **android:apiKey="0QVYGuX4_0vLI8Uro3uUP3GYvG539JlObdsXxHA"** 
/> 
</LinearLayout> 

该清单包括INTERNET和ACCESS_FINE_LOCATION权限

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="jt.com.whereami"> 
<application 
android:icon="@drawable/icon"> 
<uses-library android:name="com.google.android.maps"/> 
<activity 
android:name=".WhereAmI" 
android:label="@string/app_name"> 
<intent-filter> 
<action android:name="android.intent.action.MAIN" /> 
<category android:name="android.intent.category.LAUNCHER" /> 
</intent-filter> 
</activity> 
</application> 
<uses-permission android:name="android.permission.INTERNET"/> 
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> 
<uses-sdk android:minSdkVersion="7" /> 
</manifest> 

地图显示出来,但只显示框。

我使用Eclipse来开发,一切正常。

有什么我失踪了吗?

+0

调试键唯一作品使用debug.keystore,确保您正在运行应用程序,方法是右键单击项目并选择debug作为android。如果密钥错误,logcat中应该有与获取地图图块有关的例外情况。 – 2011-03-23 20:40:31

+0

相同的东西.. Logcat中关于错误的内容不存在 调试为android在模拟器和设备上都具有相同的结果。 – Bikeaccdnt 2011-03-23 20:58:40

+0

您的.WhereAmI.java类扩展了MapActivity? – 2011-03-23 23:24:42

回答

0

至于你说的“的地图上显示了,但只显示框” means..i经历过类似问题......只有十字线出现在屏幕上......

这是因为放大的level..U应该为mapview设置缩放大约10个左右...... !!

希望这有助于..

+0

谢谢,但我已经尝试低缩放级别,高缩放级别。同样的结果 – Bikeaccdnt 2011-03-24 12:16:07

0

apiKey我debug.keystore

关键调试地图API;如果你想看Map,你必须直接从IDE安装(例如:从Eclipse安装)。这台电脑是用来创造MD5和获取地图API 每个PC有一个MD5独特

apiKey为publicication:必须从文件的apk安装应用程序,即可查看地图