【问题标题】:Unable to get GoogleMaps to display on Android无法让 GoogleMaps 在 Android 上显示
【发布时间】: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


【解决方案1】:

正如你所说的“地图显示但只显示框”意味着..我遇到了类似的类型问题...屏幕上只出现十字标记...

这是因为缩放级别..U 应该将地图视图的缩放设置为少一些 10 左右...!!

希望这会有所帮助..

【讨论】:

  • 谢谢,但我尝试过低缩放级别、高缩放级别。结果相同
【解决方案2】:

我的 debug.keystore 的 apiKey

用于关键调试 Map API;如果要查看地图,必须直接从 IDE 安装(例如:从 Eclipse 安装)。此 PC 用于创建 MD5 并获取 MAP API 每台电脑都有一个唯一的 MD5

用于发布的apiKey:它必须从文件.apk安装应用程序才能看到地图

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多