0

Hello everyone I created an Android application which displays a google map and sets markers on the google map. The application is working fine until I sign that application.

My problem is after signing the application google map is not being loaded.

What is the problem?

I am using Google Api v2 and map fragment to view the map.

Here is my manifest code....

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

<uses-sdk
    android:minSdkVersion="4"
    android:targetSdkVersion="19" />



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

<uses-permission 
    android:name="example.tranzlogix_map.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.WRITE_EXTERNAL_STORAGE"/>
<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/goo"
    android:label="@string/app_name"
    android:theme="@style/Translucent" >

    <meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="AIzaSyB6ut74Pvg8T2rs7jg5GSjD6Es4beyxSYI"/>


    <activity
        android:name="example.tranzlogix_map.LoginActivity"
        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="example.tranzlogix_map.HelpActivity"
        android:label="@string/app_name" >

    </activity>
      <activity
        android:name="example.tranzlogix_map.MainActivity"
        android:label="@string/app_name" >

       </activity>


     </application>

  </manifest>
bluskies
  • 29
  • 8
Rag-hul
  • 1
  • 1

4 Answers4

1

You probably still have your Google maps API key based on the SHA1 hash of the DEBUG certificate.

After signing the app for release you will have to set your Maps API key based on the SHA1 hash of the RELEASE Certificate.

See displaying the release certificate fingerprint
https://developers.google.com/maps/documentation/android/start#getting_the_google_maps_android_api_v2

Obtain the Release SHA1 hash ,generate the API Key and set this as the key in the manifest

agomes
  • 331
  • 2
  • 8
0

add this meta_data under your meta_data:

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

and add this permission:

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

-------------Edit---------------

here is your Manifest, with the needed meta and Permissions as well. If you still have an error please add it to the question as edited

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

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



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

<uses-permission 
    android:name="example.tranzlogix_map.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"/>

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



<application
    android:allowBackup="true"
    android:icon="@drawable/goo"
    android:label="@string/app_name"
    android:theme="@style/Translucent" >

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


    <activity
        android:name="example.tranzlogix_map.LoginActivity"
        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="example.tranzlogix_map.HelpActivity"
        android:label="@string/app_name" >

    </activity>
      <activity
        android:name="example.tranzlogix_map.MainActivity"
        android:label="@string/app_name" >

       </activity>


     </application>

  </manifest>

looking at this the minimum API level for map is 8 so you need to change minSdkVersion to 8

Community
  • 1
  • 1
Coderji
  • 7,655
  • 5
  • 37
  • 51
  • i tried to add this meta data values but it is throwing errors,if you dont mind will you please change the meta data in my manifest and post it here.. Thanks a Lot – Rag-hul Nov 21 '13 at 09:30
  • please check the edited part. hope it works, if it didnt please update the logcat error – Coderji Nov 21 '13 at 09:41
  • Iam not getting any error...Still a grey color is displayed in the place of google map.when i sign the app the sha fingerprint is changed i have created a new android key in the google api console with that sha and my package name..what to do after that..wheather i have to use that generated api key any where in my manifest.....still very much confused.... – Rag-hul Nov 21 '13 at 10:44
0
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.example.androidmapsv2.permission.MAPS_RECEIVE" />`
Invader
  • 679
  • 3
  • 10
0

Did you try importing 'google-play-services'? Problem can occur in importing a different version of google-play-services'. I imported v29 first and was not working so sometimes you just have to stay low. I got it on using v12.