Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法在android应用程序中查看地图_Android_Google Maps - Fatal编程技术网

无法在android应用程序中查看地图

无法在android应用程序中查看地图,android,google-maps,Android,Google Maps,我使用了以下链接代码来启动,我无法查看我的应用程序,但我看到了一个带有线条的网格视图。这里是我代码的链接,请检查并告诉我 我遵循以下链接作为参考 您正在尝试使用MapView对象实现映射MapView对象是Google MapsAPI V1对象,在API V2中不受支持。您当前的问题(没有将两个API混淆在一起的事实)是API V1已被弃用,并且无法为其生成有效的API密钥 所以我的假设是,您已经为APIv2生成了这个键,并尝试将它与您的代码一起使用,这是一个GoogleAPIv1代码。这

我使用了以下链接代码来启动,我无法查看我的应用程序,但我看到了一个带有线条的网格视图。这里是我代码的链接,请检查并告诉我

我遵循以下链接作为参考


您正在尝试使用
MapView
对象实现映射
MapView
对象是Google Maps
API V1
对象,在
API V2
中不受支持。您当前的问题(没有将两个API混淆在一起的事实)是API V1已被弃用,并且无法为其生成有效的API密钥

所以我的假设是,您已经为
APIv2
生成了这个键,并尝试将它与您的代码一起使用,这是一个
GoogleAPIv1
代码。这就是为什么你看不到地图的原因

更新:

另一方面,如果您想实现
googlemapapiv2
,请看我的这篇博文 他就这个话题写道:


对于您的问题,您需要使用
MapFragment
SupportMapFragment
,具体取决于您的目标平台。

您正在尝试使用
MapView
对象实现地图
MapView
对象是Google Maps
API V1
对象,在
API V2
中不受支持。您当前的问题(没有将两个API混淆在一起的事实)是API V1已被弃用,并且无法为其生成有效的API密钥

You must register your key ay Google Services: 

All Maps API applications should load the Maps API using an API key. Using an API key enables you to monitor your application's Maps API usage, and ensures that Google can contact you about your application if necessary. If your application's Maps API usage exceeds the Usage Limits, you must load the Maps API using an API key in order to purchase additional quota.

To create your API key, visit the APIs Console at https://code.google.com/apis/console and log in with your Google Account.

Click the Services link from the left-hand menu, then activate the Google Maps API v2 service.

Once the service has been activated, your API key is available from the API Access page, in the Simple API Access section. Maps API applications use the Key for browser apps.

By default a key can be used on any site. We strongly recommend that you restrict use of your key only to domains you administer, to prevent use on unauthorized sites. You can specify which domains are allowed to use your API key by clicking the Edit allowed referrers... link for your key.

The your must declare permissions.

The you can do an activity with this code.   


//map Variable
private GoogleMap mMap;


//Set map
mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();


//Layout
<fragment
  android:id="@+id/map"
  android:name="com.google.android.gms.maps.MapFragment"
  android:layout_width="match_parent"
  android:layout_height="match_parent" />

See this to more information http://proyectosbeta.net/2012/12/configurar-y-usar-google-maps-api-v2-para-android/
所以我的假设是,您已经为
APIv2
生成了这个键,并尝试将它与您的代码一起使用,这是一个
GoogleAPIv1
代码。这就是为什么你看不到地图的原因

更新:

另一方面,如果您想实现
googlemapapiv2
,请看我的这篇博文 他就这个话题写道:

对于您的问题,您需要使用
MapFragment
SupportMapFragment
,具体取决于您的目标平台。

您必须注册您的密钥和谷歌服务:
You must register your key ay Google Services: 

All Maps API applications should load the Maps API using an API key. Using an API key enables you to monitor your application's Maps API usage, and ensures that Google can contact you about your application if necessary. If your application's Maps API usage exceeds the Usage Limits, you must load the Maps API using an API key in order to purchase additional quota.

To create your API key, visit the APIs Console at https://code.google.com/apis/console and log in with your Google Account.

Click the Services link from the left-hand menu, then activate the Google Maps API v2 service.

Once the service has been activated, your API key is available from the API Access page, in the Simple API Access section. Maps API applications use the Key for browser apps.

By default a key can be used on any site. We strongly recommend that you restrict use of your key only to domains you administer, to prevent use on unauthorized sites. You can specify which domains are allowed to use your API key by clicking the Edit allowed referrers... link for your key.

The your must declare permissions.

The you can do an activity with this code.   


//map Variable
private GoogleMap mMap;


//Set map
mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();


//Layout
<fragment
  android:id="@+id/map"
  android:name="com.google.android.gms.maps.MapFragment"
  android:layout_width="match_parent"
  android:layout_height="match_parent" />

See this to more information http://proyectosbeta.net/2012/12/configurar-y-usar-google-maps-api-v2-para-android/
所有Maps API应用程序都应使用API密钥加载Maps API。使用API密钥可以监视应用程序的Maps API使用情况,并确保Google可以在必要时就应用程序与您联系。如果应用程序的Maps API使用量超过使用限制,则必须使用API密钥加载Maps API才能购买额外配额。 要创建API密钥,请访问API控制台https://code.google.com/apis/console 并使用您的谷歌帐户登录。 单击左侧菜单中的服务链接,然后激活Google Maps API v2服务。 一旦服务被激活,您的API密钥就可以从简单API访问部分的API访问页面获得。地图API应用程序使用浏览器应用程序的键。 默认情况下,密钥可以在任何站点上使用。我们强烈建议您将密钥的使用仅限于您管理的域,以防止在未经授权的站点上使用。您可以通过单击“编辑允许的引用者”来指定允许哪些域使用您的API密钥。。。链接以获取您的密钥。 用户必须声明权限。 您可以使用此代码执行活动。 //映射变量 私有谷歌地图; //集合图 mMap=((MapFragment)getFragmentManager().findFragmentById(R.id.map)).getMap(); //布局 请参阅此以了解更多信息http://proyectosbeta.net/2012/12/configurar-y-usar-google-maps-api-v2-para-android/
您必须在Google服务中注册密钥:
所有Maps API应用程序都应使用API密钥加载Maps API。使用API密钥可以监视应用程序的Maps API使用情况,并确保Google可以在必要时就应用程序与您联系。如果应用程序的Maps API使用量超过使用限制,则必须使用API密钥加载Maps API才能购买额外配额。
要创建API密钥,请访问API控制台https://code.google.com/apis/console 并使用您的谷歌帐户登录。
单击左侧菜单中的服务链接,然后激活Google Maps API v2服务。
一旦服务被激活,您的API密钥就可以从简单API访问部分的API访问页面获得。地图API应用程序使用浏览器应用程序的键。
默认情况下,密钥可以在任何站点上使用。我们强烈建议您将密钥的使用仅限于您管理的域,以防止在未经授权的站点上使用。您可以通过单击“编辑允许的引用者”来指定允许哪些域使用您的API密钥。。。链接以获取您的密钥。
用户必须声明权限。
您可以使用此代码执行活动。
//映射变量
私有谷歌地图;
//集合图
mMap=((MapFragment)getFragmentManager().findFragmentById(R.id.map)).getMap();
//布局
请参阅此以了解更多信息http://proyectosbeta.net/2012/12/configurar-y-usar-google-maps-api-v2-para-android/

我想您需要将google Maps API密钥添加到您的应用程序中,为此,您需要在application元素中添加AndroidManifest.xml,如下行:

我想您需要将google Maps API密钥添加到您的应用程序中,为此,您需要在应用程序元素内的AndroidManifest.xml中添加以下行:

这可能有三个原因

1) 检查internet权限

2) 您使用了错误的API密钥

3) 你没有包括在内

<uses-library android:name=”com.google.android.maps” />

这可能有三个原因

1) 检查internet权限

2) 您使用了错误的API密钥

3) 你没有包括在内

<uses-library android:name=”com.google.android.maps” />

最后,我得到了解决方案。我犯的错误是元数据标记放在应用程序标记之后,这是错误的,我们必须在应用程序标记的结束标记之前指定

另一个原因是我正在使用api v1和api v2 ke