The google map is not displayed after the app is published

Hello, I have been suffering for a week I can not solve the problem. I wrote an application that gets the coordinates of buses in real time and puts (markers) on the map their location.

I used the standard Google Map Activity layout. The studio automatically creates a file in the *src/release/values/* and *src/debug/values/* folders *google_map_api.xml*

I used the keychain to create a file .jks followed the instructions and got its sha-1 key F7:19:A0:25:6D:A2:AA:9D..... (by the keytool utility)

In GoogleAPIs Console created the project and got two keys with its SHA-1 (F7:19:A0:25:6D:A2:AA:9D...) and automatically generated SHA-1 for debag.

I added the received keys to the xml file, launched the application the program started working but when I publish the application (Google Play) the map is not displayed.

The release key and the debug key both work in debug mode

enter a description of the image here enter a description of the image here

Дебаг ключ google map api

`

To get one, follow this link, follow the directions and press "Create" at the end:

https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend&keyType=CLIENT_SIDE_ANDROID&r=F7:19:A0:25:6D:A2:AA%3Bcom.gochag.comand.neqliyyat

You can also add your credentials to an existing key, using these values:

Package name:
39:5F:45:EC:40:2B:0B

SHA-1 certificate fingerprint:
39:5F:45:EC:40:2B:0B
F7:19:A0:25:6D:A2:AA
Alternatively, follow the directions here:
https://developers.google.com/maps/documentation/android/start#get-key

Once you have your key (it starts with "AIza"), replace the "google_maps_key"
string in this file.


Release
AIzaSyAoE7JLM

Debug
AIzaSyB2jp1oj
-->
<string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">AIzaSyB2jp1oj</string>

`

Release key google map api `

To do this, you can either add your release key credentials to your existing
key, or create a new key.

Note that this file specifies the API key for the release build target.
If you have previously set up a key for the debug target with the debug signing certificate,
you will also need to set up a key for your release certificate.

Follow the directions here:

https://developers.google.com/maps/documentation/android/signup

Once you have your key (it starts with "AIza"), replace the "google_maps_key"
string in this file.
-->
<string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">AIzaSyAoE7JL</string>

`

**Манифест**

    <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.gochag.comand.neqliyyat">
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <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" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

        <!--
             The API key for Google Maps-based APIs is defined as a string resource.
             (See the file "res/values/google_maps_api.xml").
             Note that the API key is linked to the encryption key used to sign the APK.
             You need a different API key for each encryption key, including the release key that is used to
             sign the APK for publishing.
             You can define the keys for the debug and release targets in src/debug/ and src/release/.
        -->

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

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


        <meta-data
            android:name="com.google.android.geo.API_KEY"
            android:value="@string/google_maps_key" />


    </application>

</manifest>

**Билдгредл**

    apply plugin: 'com.android.application'
android {
    signingConfigs {
    }
    compileSdkVersion 24
    buildToolsVersion "25.0.0"
    defaultConfig {
        applicationId "com.gochag.comand.neqliyyat"
        minSdkVersion 15
        targetSdkVersion 24
        versionCode 20
        versionName "v.1.0s"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {c
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.0.0'
    compile 'com.android.support:design:25.0.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:support-v4:24.2.1'
    compile 'com.android.support:cardview-v7:25.3.1'
    compile 'com.android.support:recyclerview-v7:25.3.1'
    compile 'com.google.android.gms:play-services-maps:10.0.1'
    testCompile 'junit:junit:4.12'
}

1 answers

I figured it out, sign the application with a key and place it on the Google Console. In the console, go to Release Management -> App Signatures. There is a "certificate for signing" and the sha1 key, and you add it to Google APIs. As I understand it, Google still signs the application itself.

 3
Author: Тамерлан Хакимзаде, 2017-09-22 21:47:07