Question

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:

  1. Generate a new keytool

    keytool -genkey -v -keystore my-keystore-name.keystore
            -alias myKey1 -keyalg RSA -keysize 2048 -validity 20000 
    
  2. From Eclipse I "Export signed application package" using the keystore file (and key) I got from step 1.

  3. 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>
Was it helpful?

Solution

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"/>

OTHER TIPS

Why don't you create a new key from eclipse, Android Tools -> Export signed package, create new keystore.

Generate the SHA-1 key, use it to get the API key and place it in the meta data present in manifest file

Use the keystore that you use for create .apk file of your project.

Open terminal and write below command keytool -list -v -keystore your_keystore_name -alias your_alias_name after your press enter it will ask you for password give your keystore password. press enter. it will genrate MD5 key & SHA1 key.(key like this)

SHA1: BB:0D:AC:74:D3:21:E1:43:67:71:9B:62:90:AF:A1:66:6E:44:5D:75

use this SHA1 key in googleconsole when you creating browser key for map.

This is work for me.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top