没有地图显示上MapActivity

问题描述:

我已经下载了谷歌API和现在有什么似乎是我的地图XML的标准问题是只显示一个灰色握在谷歌地图应显示,如下所示:没有地图显示上MapActivity

enter image description here

我已经尝试了两个API密钥(通过生成一个新的)无济于事。我已经加入了互联网许可,谷歌在我的清单映射库,如下所示:

清单:

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

<uses-sdk android:minSdkVersion="8" /> 

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

<application 
    android:icon="@drawable/ic_launcher" 
    android:label="@string/app_name" > 

    <activity 
     android:name=".MainMap" 
     android:label="@string/app_name" > 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 
    <uses-library android:name="com.google.android.maps" /> 
</application> 
</manifest> 

API密钥:

enter image description here

这是我的地图XML布局:

<?xml version="1.0" encoding="utf-8"?> 

<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="AIzaSyBV_Zio-pysGWfjGo7dUpGvYRZ9PB3NQLc"/> 

</RelativeLayout> 

我将我的项目设置为Google API的SDK版本,与我的AVD一样。

当我的应用程序加载和我的意图开始,我得到的错误在我的控制台:

02-16 15:55:04.637: E/MapActivity(305): Couldn't get connection factory client 
+1

阅读[this](http://samir-mangroliya.blogspot.in/p/android-map-api-key.html)并生成API key [here](https://developers.google。 – 2013-02-16 16:19:43

+0

XML应用程序不能在应用程序的XML中使用 – JustinDanielson 2013-02-16 16:34:12

+0

您试图做的这些方法在2012年12月被折旧:请阅读[this文件(https://developers.google.com/maps/documentation/android/v1/)。即使您使用新的Google Maps API v2,也无法在模拟器中部署您的应用程序:请参阅[本文档](http://developer.android.com/intl/ko/google/play-services/setup。 html) – BBonDoo 2013-02-23 02:08:07

我认为你的清单和布局文件都可以。这个问题通常是由于关键问题引起的。通过使用SHA1证书指纹,我得到了同样的问题。所以我去了MD5证书指纹。去这个网站https://developers.google.com/maps/documentation/android/v1/maps-api-signup并给你的MD5指纹并获得钥匙。获得MD5指纹

  1. 通过在运行中键入cmd来打开命令提示符。开始⇒运行⇒ 键入cmd
  2. 转到JDK的键入CD C bin目录:\路径到JDK-DIR \ BIN \

    在我的情况我输入CD C:\ Program Files文件\的Java \ jdk1.7.0_07 \ BIN \

  3. 然后输入密钥工具-exportcert -alias androiddebugkey -keystore “C:\用户\用户名\ .android \ debug.keystore” -list -v

    在我我输入keytool -exportcert -alias androiddebugkey -keystore“C:\ Users \ User \ .android \ debug.keystore”-list -v

  4. 然后您将被要求输入密码。默认密码是android。

最后你会得到MD5指纹。

我有同样的问题,在模拟器采用Android 2.3.3,并同时寻求解决方案我已经搜索发现这是该OS版本的模拟器的已知问题。只需尝试其他版本的模拟器,它应该可以工作。希望这可以帮助。