当我从Play商店下载我的应用程序时,为什么不显示谷歌地图?

时间:2014-09-20 04:32:18

标签: android google-maps google-maps-android-api-2

  • 我开发了一个与谷歌相关的小应用程序。
  • 当我将应用程序从我的PC直接运行到移动设备时,
  • 地图显示并且一切正常,但是当我在Play商店的个人帐户上上传相同的应用程序时,当我下载时,地图没有显示。 - 它与SH1指纹有关或与地图键有关吗?
  • 请帮助我的朋友,因为我没有找到任何解决方案,但我在谷歌搜索中输入了正确的关键字。

  • 提前感谢您

我的清单文件:

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

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

    <permission
        android:name="com.example.maps.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />

    <uses-permission android:name="com.example.maps.permission.MAPS_RECEIVE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

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

    <application
        android:allowBackup="true"
        android:icon="@drawable/logo"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
           android:name="com.example.maps.CurrentLocationMainActivity"
            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="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-jbt0" />
        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
    </application>

</manifest>

2 个答案:

答案 0 :(得分:0)

你必须使用ReleaeKey来谷歌地图发布应用程序,否则它将在地图上显示空白页面,因为你正在使用调试键,当你直接从PC调试应用程序时运行。 所以使用Release键。

这样做:

           C:\Program Files\Java\jdk1.6.0_45\bin>keytool -genkey -v -keystore "C:\Users\cp
 01\.android\releasekey.ketstore" -alias release_alias -keyalg RSA -keysize 2048
-validity 10000
 Enter keystore password:
 Re-enter new password:
 What is your first and last name?
[Unknown]:
What is the name of your organizational unit?
[Unknown]:
What is the name of your organization?
[Unknown]:
   What is the name of your City or Locality?
[Unknown]:
What is the name of your State or Province?
[Unknown]:
What is the two-letter country code for this unit?
[Unknown]:
Is CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown correct?
[no]:  yes

   Generating 2,048 bit RSA key pair and self-signed certificate (SHA1withRSA) wit
 a validity of 10,000 days
    for: CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknow

  Enter key password for <release_alias>
    (RETURN if same as keystore password):
 Re-enter new password:
 [Storing C:\Users\cpc01\.android\releasekey.ketstore]



  C:\Program Files\Java\jdk1.6.0_45\bin>keytool -list -alias release_alias -keyst
  re c:\Users\cpc01\.android\releasekey.ketstore
 Enter keystore password:
 release_alias, Jul 25, 2013, PrivateKeyEntry,
 Certificate fingerprint (MD5): 6A:CA:68:3D:E9:9F:B9:15:22:2A:AB:01:30:82:CC:2A

 C:\Program Files\Java\jdk1.6.0_45\bin>keytool -list -v -alias release_alias -ke
 store c:\Users\cpc01\.android\releasekey.ketstore
Enter keystore password:
Alias name: release_alias
Creation date: Jul 25, 2013
Entry type: PrivateKeyEntry
Certificate chain length: 1
Certificate[1]:
 Owner: CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown
 Issuer: CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown
Serial number: 51f0c02c
 Valid from: Thu Jul 25 11:35:32 IST 2013 until: Mon Dec 10 11:35:32 IST 2040
 Certificate fingerprints:
     MD5:  6A:CA:68:3D:E9:9F:B9:15:22:2A:AB:01:30:82:CC:2A
     SHA1: 0F:8A:3C:6A:8F:41:CD:B4:F5:12:85:0D:B6:01:D9:30:E6:5D:28:64
     Signature algorithm name: SHA1withRSA
     Version: 3

这是制作发布密钥库和生成SHA1 fingreprint的完整过程,现在将此SHA1代码添加到Google API控制台上的注册APP。

如果发现有用,请接受并投票回答,谢谢。

答案 1 :(得分:0)

*当我们上传一个apk到Play商店时,我们应该要求签名apk并且在烧过的apk后sha1指纹将会改变,在google map v2需要一个从谷歌控制台获得的密钥,我们需要SHA1指纹所以你应该创建通过新的SHA1指纹再次谷歌地图键。通过以下过程获得新的SHA1

1.签名一个apk。

2.再过去你会看到新的sha1

3.现在创建一个新密钥并粘贴到项目中

4.再次签名。

5.最终上传

见下文我上传了续集中的所有图片以查看新的sga1 * enter image description here

enter image description here

enter image description here

enter image description here