Search code examples
androidandroid-activitymaps

MapsActivity works in debug but not in release +android


The app debug works fine but in the release doesnt work. Here is the AndroidManifest

<?xml version="1.0" encoding="utf-8"?>


<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.poldevs.pabloelmapas">
    <!--
         The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
         Google Maps Android API v2, but you must specify either coarse or fine
         location permissions for the 'MyLocation' functionality.
    -->
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.INTERNET" />

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




    <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="AIzaSyCPHx0_******"/>


    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.AppCompat.NoActionBar">
        <activity android:name=".ChatGlobalActivity"></activity>
        <activity android:name=".fotoperfil" />
   
        <meta-data
            android:name="com.google.android.geo.API_KEY"
            android:value="@string/google_maps_key" />

        <activity
            android:name=".MapsActivity"
            android:label="@string/title_activity_maps" />
        <activity android:name=".ChatActivity" />
        <activity android:name=".Mapa_Activity" />
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

      

    </application>

</manifest>

I hava tried creating different API keys from google, both works on debug version but not in release, the map doesnt load. Also I have a key for the debug version and another key for the release version (I have tried with the same key but still not working.enter image description here


Solution

  • Have you generated the release key for google map. follow this link to generate a release key for google map.

    Before publishing application into play store you have to follow some step to create release key with your app signing keystore.