简体   繁体   English

谷歌地图没有出现在我的MapActivity中

[英]Google Map not appearing in my MapActivity

I have created a release keystore using the Eclipse IDE. 我使用Eclipse IDE创建了一个发布密钥库。 I signed it using keytool and registered on Google Maps. 我使用keytool签名并在Google地图上注册。 I plugged in the key but my map doesn't show up. 我插上钥匙,但我的地图没有出现。

Maps show up properly when I use the key associated with my debug keystore.

How can I diagnose this? 我怎么诊断这个? I followed the same steps as i did with debug, for release. 我按照与调试相同的步骤进行发布。

UPDATE: 更新:

Here is my manifest file: 这是我的清单文件:

      <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.android.cancertrials" android:versionCode="1"
    android:versionName="1.0">
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.CALL_PHONE"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">
        <activity android:label="@string/app_name" android:name="splash">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".HomeActivity" android:label="@string/app_name" android:windowSoftInputMode="stateHidden">
        </activity>
        <activity android:name=".moreactivity" android:label="@string/app_name">
        </activity>
        <activity android:name=".aboutmedtrust" android:label="@string/app_name">
        </activity>
        <activity android:name=".aboutclinical" android:label="@string/app_name">
        </activity>
        <activity android:name=".aboutglaxosmith" android:label="@string/app_name">
        </activity>
        <activity android:name=".termsofuse" android:label="@string/app_name">
        </activity>
        <activity android:name=".privacy" android:label="@string/app_name">
        </activity>
        <activity android:name=".feedback" android:label="@string/app_name">
        </activity>
        <activity android:name=".informationcancer" android:label="@string/app_name">
        </activity>
        <activity android:name="AdvanceSearchActivity" android:label="@string/app_name">
        </activity>
        <activity android:name="SearchingActivity"></activity>
        <activity android:name="AdvanceSearchTab1"></activity>
        <activity android:name="AdvanceSearchTab2"></activity>
        <activity android:name="DetailedActivity"></activity>
        <activity android:name="summary"></activity>
        <activity android:name="conditions"></activity>
        <activity android:name="description"></activity>
        <activity android:name="inclusion"></activity>
        <activity android:name="exclusion"></activity>
        <activity android:name="BookmarkActivity"></activity>
        <activity android:name="RecentActivity"></activity>
        <activity android:name="information"></activity>
    <uses-library android:name="com.google.android.maps"></uses-library>
    <activity android:name="Mapsactivity">
    </activity>
    <activity android:name="mapView"></activity>

</application>
    <uses-sdk android:minSdkVersion="3" />

</manifest> 

Did you add the internet permission? 你添加了互联网权限吗? This question is asked literally every day. 这个问题每天都在逐字逐句地提出。

So I encountered this problem myself yesterday and I resolved by manually signing the .apk 所以我昨天自己遇到了这个问题,我通过手动签署.apk来解决

I assume you are using your private keystore and you have entered the release map key in your mapview (and other resources, as needed). 我假设您正在使用私有密钥库,并且已在mapview中输入了发布映射密钥(以及其他资源,根据需要)。

In order to do, you choose your projekt from Eclipse's project explorer (right click) -> Android Tools -> Export unsigned package. 为此,您可以从Eclipse的项目浏览器(右键单击) - > Android工具 - >导出未签名的包中选择您的项目。 Save it where ever you like. 随时随地保存。

Open your terminal (I'm on a Windows 7 machine), cd into your jdk folder (NOT jre), cd further into bin\\ . 打开你的终端(我在Windows 7机器上),进入你的jdk文件夹(不是jre),进一步进入bin \\。

Use following command: (Note that the " are required if you type a path) 使用以下命令:(请注意,“如果键入路径,则需要”)

        jarsigner -verbose -sigalg MD5withRSA -digestalg SHA1 -keystore "path-to-your-keystore" "path-to-your-apk" <apk alias> -certs 

To verify the signing process do 要验证签名过程

jarsigner -verify "path-to-recently-signed-apk" -verbose 

(You can leave the verbose option out if you want). (如果需要,可以保留详细选项)。 It will (hopefully) show jar verified (eventually it will warn you about entries without a validated certificate chain, that didnt matter in my case) 它(希望)会显示jar验证(最终它会警告你没有经过验证的证书链的条目,这在我的情况下并不重要)

Then run zipalign: 然后运行zipalign:

zipalign -v 4 "path-to-signed-apk" "path-to-signed-and-aligned.apk"

Note that it will create a new apk, which is aligned to googles standards. 请注意,它将创建一个新的apk,它与googles标准一致。

Install that apk and your maps should show up fine! 安装apk和你的地图应该显示正常!

From: http://developer.android.com/tools/publishing/app-signing.html#ExportWizard 来自: http//developer.android.com/tools/publishing/app-signing.html#ExportWizard

You have to obtain a separate API key when signing with the release key store as your fingerprint changes. 在指纹更改时使用版本密钥库进行签名时,您必须获取单独的API密钥。

Make sure to also install the .apk signed with the right key. 确保还使用正确的密钥安装.apk。

Update: What I meant is are you sure you sign your APK with the right key? 更新:我的意思是你确定用正确的密钥签署你的APK? That means are you sure you sign it with the release keystore when generating the APK? 这意味着您确定在生成APK时使用发布密钥库对其进行签名吗?

When you are exporting it, are you actually really selecting the keystore with which to sign it? 当您导出它时,您实际上是否真的选择了用于签名的密钥库?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM