【发布时间】:2011-03-23 20:31:56
【问题描述】:
我正在尝试让 GoogleMaps 在模拟器或我的 Android 设备上显示.. 最好同时显示。
我已经浏览了互联网上有关此的所有内容,但没有运气
布局 - Main.xml 有我的 debug.keystore 的 apiKey
<?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 进行开发,其他一切正常。
我有什么遗漏吗?
【问题讨论】:
-
调试密钥仅适用于 debug.keystore,因此请确保您通过右键单击项目并选择 debug as android 来运行应用程序。如果键错误,logcat 中应该会出现与获取地图图块相关的异常。
-
同样的事情.. logcat 中没有关于错误的任何内容 Debug as android 在模拟器和设备上的结果相同。
-
您的 .WhereAmI.java 类扩展了 MapActivity?
-
是的,公共类 WhereAmI 扩展了 MapActivity
标签: android google-maps maps