在MapView类Android应用程序 [英] MapView in android application

查看:216
本文介绍了在MapView类Android应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想包括在我的Andr​​oid应用程序谷歌地图。

I am trying include google map in my android application.

我通过<一个了href=\"https://developers.google.com/maps/documentation/android/start?hl=fr#getting_the_google_maps_android_api_v2\"相对=nofollow>此过程获取地图API密钥。

I gone through this procedure to get the Map API key.

拿到钥匙后,我写了下面的code在我的应用程序中显示地图。

After getting the key i wrote the following code to display the map in my application.

我的清单文件

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mymap"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="11"
    android:targetSdkVersion="17" />

<uses-permission android:name="android.permission.INTERNET" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <uses-library android:name="com.google.android.maps" />

    <activity
        android:name="com.example.mymap.LocationActivity"
        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>

布局
     &LT; com.google.android.maps.MapView
        机器人:ID =@ + ID /图形页面
        机器人:layout_width =FILL_PARENT
        机器人:layout_height =FILL_PARENT
        机器人:apiKey =的myKey
        机器人:可点击=真
        机器人:启用=真/&GT;

当我跑我得到这样一个异常的应用程序。

When i run the application i am getting an exception like this.

03-28 14:31:14.868: W/System.err(21147): IOException processing: 26

03-28 14:31:14.868: W/System.err(21147): java.io.IOException: Server returned: 3

03-28 14:31:14.868: W/System.err(21147):    at android_maps_conflict_avoidance.com.google.googlenav.map.BaseTileRequest.readResponseData(BaseTileRequest.java:115)

03-28 14:31:14.868: W/System.err(21147):    at android_maps_conflict_avoidance.com.google.googlenav.map.MapService$MapTileRequest.readResponseData(MapService.java:1473)

03-28 14:31:14.868: W/System.err(21147):    at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.processDataRequest(DataRequestDispatcher.java:1117)

03-28 14:31:14.868: W/System.err(21147):    at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.serviceRequests(DataRequestDispatcher.java:994)

03-28 14:31:14.868: W/System.err(21147):    at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher$DispatcherServer.run(DataRequestDispatcher.java:1702)

03-28 14:31:14.868: W/System.err(21147):    at java.lang.Thread.run(Thread.java:856)

请帮我解决这个问题。

Please help me to solve this.

推荐答案

这是一个已知的错误,当你有一个问题,你的API密钥:

This is a known error when you have a problem with your API key:

一起来看看:

<一个href=\"http://stackoverflow.com/questions/12448034/android-google-map-errors-basetilerequest-server-returned-3\">android,谷歌地图错误:BaseTileRequest,服务器返回:3

谷歌地图Android中签署的API密钥错误

更新:

从您发布获取你正​​在为谷歌地图API V2的一个关键,因此它不会与谷歌地图API V1的工作重点。链接

from the link you posted for getting the Key you are getting a key for Google Map API V2 and hence it wont work with Google Maps API V1.

要整合谷歌地图API V2你可以按照这个博客帖子我对这个题目写道:

To integrate Google Map API V2 you can follow this blog post I wrote on this topic:

谷歌地图API V2

这篇关于在MapView类Android应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆