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,在我的应用程序中,我使用了谷歌地图功能。为此,我使用了自己的密钥库并创建了MD5指纹。后来我从谷歌获得了基于MD5的xml 问题: 它在模拟器中工作。但在真实设备中并没有显示任何内容。但网格是可见的 示例—类 安卓清单 <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATIO

在我的应用程序中,我使用了谷歌地图功能。为此,我使用了自己的密钥库并创建了MD5指纹。后来我从谷歌获得了基于MD5的xml

问题:

它在模拟器中工作。但在真实设备中并没有显示任何内容。但网格是可见的

示例—类

安卓清单

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

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

   <activity
     android:name=".First"
     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>

任何人都可以找出地图为什么不显示在设备中。请提前感谢

用此替换您的mapview xml代码,然后重试

<com.google.android.maps.MapView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mapview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:clickable="true"
    android:apiKey="Your API Key"
/>


另外,请确保您的设备可以访问互联网。

实际上,我发现的问题是,只有从android market下载应用程序时,地图视图才会显示,因为我们使用的是签名api密钥


我想这就是为什么在运行eclipse时它没有显示的原因。

重新生成API密钥并尝试againi已经做了很多次。但设备中只显示网格。试试这个。同样的问题。通过使用自定义调试密钥库,它在eclipse首选项中显示“密钥库被篡改,或密码不正确”错误…如何更正此错误?实际上logcat显示一些警告否,当然可以通过android emulator显示MapView。为此,您必须从以下位置获取google maps api密钥:对于emulator,它将显示使用默认密钥库。但对于设备,我认为应该手动创建密钥库。
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:orientation="vertical" >

<com.google.android.maps.MapView
 android:id="@+id/mapview"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"
 android:apiKey="0wINx0c2YuEd3mkyPwidZyeoz_HiyN3jrts-Q" />

</LinearLayout>
 08-10 14:27:56.841: W/MapActivity(20815): Recycling dispatcher       android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher@405b  9458
 08-10 14:27:56.851: V/MapActivity(20815): Recycling map object.
 08-10 14:27:56.901: I/MapActivity(20815): Handling network change   notification:CONNECTED
 08-10 14:27:56.901: E/MapActivity(20815): Couldn't get connection factory client
<com.google.android.maps.MapView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mapview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:clickable="true"
    android:apiKey="Your API Key"
/>