Search code examples
androidgoogle-mapsapi-key

Google Maps not shown in the release mode


My question is common, but I have tried all the suggestions listed before to solve the issue of that Google Maps only shown in debug mode not in release mode. The below have been tried (for sure I have used the SHA-1 certificate fingerprint for debug keystore and release keystore as per google documents):

  1. Added different api Keys in the google_map_api.xml for debug and
    release.
  2. Added same key for both debug and release modes.
  3. Write the key manually in thee Manifest.xml
  4. Refer to the string in the Manifest.xml

Update:


<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_UPDATES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />



<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">

    <!--
      The API key for Google Maps-based APIs.
 -->
    <meta-data
    android:name="com.google.android.geo.API_KEY"
    android:value="@string/google_maps_key" />

    <activity
        android:name="local.application.user.myApp.MainActivity"
        android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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


Solution

  • After trying all suggested solutions (Thx for everyone). I tried to disable the Google Maps Api and re-enabled it again (from console.developers.google.co) and it has been working fine since then.