Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.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_Android Mapview - Fatal编程技术网

Android地图应用程序未在设备上显示任何地图

Android地图应用程序未在设备上显示任何地图,android,android-mapview,Android,Android Mapview,这是我在指纹0o8crg5bhpmqqb1pvyyyzqnfj2zbpdma6xfj后得到的谷歌地图密钥 我把它放在main.xml文件中。应用程序在模拟器上运行良好,并显示地图。但当我把它部署到真正的设备上时,它并没有显示任何地图。它只显示灰色背景,没有任何地图。我该怎么办 main.xml文件 <?xml version="1.0" encoding="utf-8"?> <com.google.android.maps.MapView xmlns:android="htt

这是我在指纹
0o8crg5bhpmqqb1pvyyyzqnfj2zbpdma6xfj后得到的谷歌地图密钥

我把它放在
main.xml
文件中。应用程序在模拟器上运行良好,并显示地图。但当我把它部署到真正的设备上时,它并没有显示任何地图。它只显示灰色背景,没有任何地图。我该怎么办

main.xml文件

 <?xml version="1.0" encoding="utf-8"?>
<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="0o8CRg5BhPmqQB1pvyYZQNfJ2ZbpDMa6XFunRwA"
android:enabled="true"
/>
 ?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.androidhive.googlemaps"
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" >

    <!--  Add Google Map Library -->
    <uses-library android:name="com.google.android.maps"   />

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

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

 <!-- Allow to connect with internet -->

   </manifest>

清单文件

 <?xml version="1.0" encoding="utf-8"?>
<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="0o8CRg5BhPmqQB1pvyYZQNfJ2ZbpDMa6XFunRwA"
android:enabled="true"
/>
 ?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.androidhive.googlemaps"
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" >

    <!--  Add Google Map Library -->
    <uses-library android:name="com.google.android.maps"   />

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

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

 <!-- Allow to connect with internet -->

   </manifest>
?xml version=“1.0”encoding=“utf-8”>

为设备创建APK文件时使用的调试证书和签名证书都生成了密钥。如果您使用的是调试证书的密钥,而不是生产签名证书的密钥,则会出现一个灰色屏幕,没有显示地图

<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="PUT-KEY-FOR-PRODUCTION-CERT-HERE"
        />


有关在此处生成调试和签名证书api密钥的详细信息:

为什么我的应用程序不在真实设备上显示映射在emulator中是否正常工作?您正在使用哪个设备?是的,在emulator she me地图上工作,但当我在实际中部署时,设备未显示我用于登录应用程序的WHQT密钥??映射apiKey=“0o8crg5bhpmqqb1pvyyzqnfj2zbpdma6xfj”这一个??不是键。我在询问您用于测试应用程序的设备。我获得了此映射api密钥0O8CRG5BHPMQB1PVYYZQNFJ2ZBPDMA6XF,并且在xml文件中的位置是在emulator上显示映射良好,但在真实的电话设备中不可见。在将apk文件上载到您的设备之前,您必须有一个密钥存储用于对其进行签名。如果您使用的是eclipse,那么您需要提供密钥库文件的位置,以便在应用程序在任何设备上运行之前对其进行签名。您的意思是默认密钥库,位于Eindows->Preference->Android->Build->C:\Documents and Settings\Nazeer\.Android\debug.keystore显示用于在emulator中运行或在设备上调试的调试密钥,但我你认为你需要使用一个单独的api密钥和一个签名证书来实现这一点,更多关于android应用程序签名的信息请点击这里:在我获得googlemay api后不久,请致电我如何登录我的应用程序??