谷歌地图Android版中的灰色网格 [英] Google maps in android gray grid

查看:188
本文介绍了谷歌地图Android版中的灰色网格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在一个应用程序使用mapviews,所以我跟着一个的步骤之一。但我只是一个灰色的网格。我生成的API密钥四次,但每次都得到相同的结果。

您能帮帮我吗?

这是我得到的错误:

 未能找到com.google.settings供应商信息
无法获得连接工厂客户端

我的清单文件

 <?XML版本=1.0编码=UTF-8&GT?;
<清单的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    包=com.me.test.g_maps
    安卓版code =1
    机器人:=的versionName1.0>        <用途-SDK
        安卓的minSdkVersion =7
        机器人:targetSdkVersion =17/>       <使用许可权的android:NAME =android.permission.INTERNET对/>
         <使用许可权的android:NAME =com.google.android.providers.gsf.permission.READ_GSERVICES/>
         <使用许可权的android:NAME =com.me.test.g_maps.permission.MAPS_RECEIVE/>
         <使用许可权的android:NAME =android.permission.WRITE_EXTERNAL_STORAG​​E/>
         <使用许可权的android:NAME =android.permission.ACCESS_FINE_LOCATION/>        <许可
        机器人:名字=com.me.test.g_maps.permission.MAPS_RECEIVE
        安卓的ProtectionLevel =签名/>        <应用
        机器人:allowBackup =真
        机器人:图标=@绘制/ ic_launcher
        机器人:标签=@字符串/ APP_NAME
        机器人:主题=@风格/ AppTheme>
            <活动
            机器人:名字=com.me.test.g_maps.MainActivity
            机器人:标签=@字符串/ APP_NAME>
                &所述;意图滤光器>
                    <作用机器人:名字=android.intent.action.MAIN/>                    <类机器人:名字=android.intent.category.LAUNCHER/>
                &所述; /意图滤光器>
            < /活性GT;            &所述;元数据
        机器人:名字=com.google.android.maps.v2.API_KEY
        机器人:值=AIzaSyCEgLQ7HgXiKTP8grZRmpIPAeWoSfAjrBM/>            <使用库机器人:名字=com.google.android.maps/>        < /用途>        < /清单>

我的活动

 包com.me.test.g_maps;    进口android.os.Bundle;   进口com.google.android.maps.MapActivity;    公共类MainActivity扩展MapActivity {        @覆盖
        保护无效的onCreate(捆绑savedInstanceState){
            super.onCreate(savedInstanceState);
            的setContentView(R.layout.activity_main);
        }        @覆盖
        保护布尔isRouteDisplayed(){
            // TODO自动生成方法存根
            返回false;
        }    }

我的XML

 <?XML版本=1.0编码=UTF-8&GT?;
    <的RelativeLayout的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
        机器人:layout_width =FILL_PARENT
        机器人:layout_height =FILL_PARENT>        < com.google.android.maps.MapView
            机器人:ID =@ + ID /图形页面
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =FILL_PARENT
            机器人:启用=真
            机器人:可点击=真
            机器人:apiKey =AIzaSyCEgLQ7HgXiKTP8grZRmpIPAeWoSfAjrBM
            />    < / RelativeLayout的>


解决方案

,因为它看起来你有几个问题(如果您的定位谷歌地图API V2技术)

1 首先删除此权限。

 <使用库机器人:名字=com.google.android.maps/>

这是谷歌地图API V1的一部分,不需要在谷歌地图API V2。

2 谷歌地图API V2需要OpenGL的支持,V2,并为此你有以下添加到您的清单文件:

 <使用特征
  机器人:glEsVersion =0x00020000
  机器人:要求=真/>

3 查看您在谷歌的API控制台右侧API转向:

4。再次尝试重新生成密钥,通过删除 debug.keystore ,编译一个项目,这将导致一个新的 SHA1 签名。

5 如果您运行仿真器应用程序,查看这篇博客我就如何使在模拟器谷歌地图API V2写道:

在谷歌地图API V2模拟器

I'm trying to use mapviews in an app, so I followed the steps one by one. But I got just a gray grid. I generated the API key four times, but get the same result every time.

could you please help me?

These are the errors I got:

failed to find provider info for com.google.settings
couldn't get connection factory client

my manifest file

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

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

       <uses-permission android:name="android.permission.INTERNET" />
         <uses-permission     android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
         <uses-permission     android:name="com.me.test.g_maps.permission.MAPS_RECEIVE"/>
         <uses-permission     android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
         <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

        <permission
        android:name="com.me.test.g_maps.permission.MAPS_RECEIVE"
        android:protectionLevel="signature"/>

        <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
            <activity
            android:name="com.me.test.g_maps.MainActivity"
            android:label="@string/app_name" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />

                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>

            <meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="AIzaSyCEgLQ7HgXiKTP8grZRmpIPAeWoSfAjrBM"/>

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

        </application>

        </manifest> 

my activity

    package com.me.test.g_maps;

    import android.os.Bundle;

   import com.google.android.maps.MapActivity;

    public class MainActivity extends MapActivity {

        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
        }

        @Override
        protected boolean isRouteDisplayed() {
            // TODO Auto-generated method stub
            return false;
        }

    }

my xml

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent">

        <com.google.android.maps.MapView 
            android:id="@+id/mapView"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:enabled="true"
            android:clickable="true"
            android:apiKey="AIzaSyCEgLQ7HgXiKTP8grZRmpIPAeWoSfAjrBM"
            />

    </RelativeLayout>

解决方案

As it looks you have few problems (in case your targeting Google Map API V2 technology)

1. First of all remove this permission:

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

It's a part of Google Maps API V1 and is not needed in Google Maps API V2.

2. Google Maps API V2 needs OpenGL-v2 support, and therefor you have to add the following to your manifest file:

<uses-feature
  android:glEsVersion="0x00020000"
  android:required="true"/>

3. Check that you are turning on the right API in the Google API Console:

4. Try to regenerate the key again, by deleting the debug.keystore, compiling a project and that will result in a new SHA1 signature.

5. If you run your application in the emulator, check this blog post I wrote on how to enable Google Map API V2 in the emulator:

Google Map API V2 in the Emulator

这篇关于谷歌地图Android版中的灰色网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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