安装真实设备后,谷歌地图API V2空白地图地图、空白、真实、设备

2023-09-07 13:48:35 作者:-信 仰。

当我使用模拟应用程序从日食设备一切正常,但在我生成APK文件并安装它,我的地图是空白的。

我按照下列步骤操作:

生成一个新的密钥工具

 的keytool -genkey -v -keystore我-密钥库name.keystore        -alias myKey1 -keyalg RSA -keysize 2048 -validity 20000 

谷歌将大幅下调谷歌地图API使用费率

从Eclipse的我导出签名的应用程序包使用密钥库文件(密钥),我从第1步得到。

的APK复制到设备上,选择安装程序包

清单:

 <?XML版本=1.0编码=UTF-8&GT?;    <清单的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android    包=apt.login    安卓版code =1    机器人:=的versionName1.0>    <用途-SDK        安卓的minSdkVersion =11        机器人:targetSdkVersion =17/>    <使用许可权的android:NAME =android.permission.INTERNET对/>    <许可    机器人:名字=apt.login.permission.MAPS_RECEIVE    安卓的ProtectionLevel =签名/>    <使用许可权    机器人:名字=apt.login.permission.MAPS_RECEIVE/>    <使用许可权    机器人:名字=com.google.android.providers.gsf.permission.READ_GSERVICES/>    <使用许可权的android:NAME =android.permission.INTERNET对/>    <使用许可权的android:NAME =android.permission.ACCESS_NETWORK_STATE/>    <使用许可权的android:NAME =android.permission.WRITE_EXTERNAL_STORAG​​E/>    <使用许可权的android:NAME =android.permission.ACCESS_COARSE_LOCATION/>    <使用许可权的android:NAME =android.permission.ACCESS_FINE_LOCATION/>    <应用        机器人:权限=android.permission.WRITE_EXTERNAL_STORAG​​E        机器人:allowBackup =真        机器人:图标=@绘制/ ic_launcher        机器人:标签=@字符串/ APP_NAME        机器人:主题=@风格/ AppTheme        机器人:testOnly =假        机器人:可调试=真正的>         <使用库机器人:名字=com.google.android.maps/>         &所述;元数据            机器人:名字=com.google.android.maps.v2.API_KEY            机器人:值=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/>         &所述;元数据    机器人:名字=com.google.android.gms.version    机器人:值=@整数/ GOOGLE_PLAY_SERVICES_VERSION/>        <活动            机器人:名字=apt.login.UIactivity.Login            机器人:标签=@字符串/ APP_NAME>            &所述;意图滤光器>                <作用机器人:名字=android.intent.action.MAIN/>                <类机器人:名字=android.intent.category.LAUNCHER/>            &所述; /意图滤光器>        < /活性GT;        <活动            机器人:名字=apt.login.UIactivity.Loading>        < /活性GT;        <活动            机器人:名字=apt.login.UIactivity.Mapa>        < /活性GT;        <活动            机器人:名字=apt.login.UIactivity.Splitbar            机器人:标签=@字符串/ APP_NAME>        < /活性GT;    < /用途>    < /清单> 

解决方案

您应该尝试移动<包含您的API密钥之前;元数据/&GT在结束标记。

您还没有在下面那里,你应该:

<使用特征     机器人:glEsVersion =0x00020000     机器人:要求=真/>

When I emulate the app from eclipse using the device everything's OK, but after I generate the apk file and have it installed, my map is blank.

I followed these steps:

Generate a new keytool

keytool -genkey -v -keystore my-keystore-name.keystore
        -alias myKey1 -keyalg RSA -keysize 2048 -validity 20000 

From Eclipse I "Export signed application package" using the keystore file (and key) I got from step 1.

Copy the apk to the device and select "package installer"

Manifest:

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

    <uses-sdk
        android:minSdkVersion="11"
        android:targetSdkVersion="17" />

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

    <permission

    android:name="apt.login.permission.MAPS_RECEIVE"

    android:protectionLevel="signature"/>

    <uses-permission
    android:name="apt.login.permission.MAPS_RECEIVE"/>

    <uses-permission
    android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>

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

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

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

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

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


    <application
        android:permission="android.permission.WRITE_EXTERNAL_STORAGE"
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" 
        android:testOnly="false"
        android:debuggable="true">    



         <uses-library android:name="com.google.android.maps" />
         <meta-data

            android:name="com.google.android.maps.v2.API_KEY"

            android:value="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"/>

         <meta-data
    android:name="com.google.android.gms.version"
    android:value="@integer/google_play_services_version" />


        <activity
            android:name="apt.login.UIactivity.Login"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

        <activity
            android:name="apt.login.UIactivity.Loading">
        </activity>
        <activity
            android:name="apt.login.UIactivity.Mapa">
        </activity>

        <activity
            android:name="apt.login.UIactivity.Splitbar"
            android:label="@string/app_name" >
        </activity>

    </application>

    </manifest>

解决方案

You should try moving the <meta-data/> containing your API KEY to just before the closing tag.

You also don't have the following in there and you should:

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