0

Google Maps doesn't seem to work in any way in my release apk. My debug works perfectly, so that indicates that my code is correct. So, there must be a problem with my API. I've tried multiple solutions mentioned here in Stackoverflow, but doesn't work anyway. I've changed the API in my google_map_api_xml. My SHA1 fingerprints are both different for my debug and release version in my Google Developers Console and i've checked them in the Terminal I've tried adding these:

signingConfigs {
        release {
            storeFile file("mykeystore")
            storePassword 'password'
            keyAlias 'mykeyalias'
            keyPassword 'password'
        }
    }
    buildTypes {
        release {
            signingConfig signingConfigs.release
        }
Phantômaxx
  • 36,442
  • 21
  • 78
  • 108
Núria Bosch
  • 27
  • 1
  • 4
  • what kind of error do you have? – xcesco Jan 07 '18 at 10:55
  • Are you using ProGuard....if so checkout https://stackoverflow.com/questions/46908864/how-to-keep-google-maps-in-obfuscation – John O'Reilly Jan 07 '18 at 10:58
  • @xcesco I cannot find my error in my logcat (or don't know how to find it, I'm a programmer but I hadn't used AAndroidstudio before). But the main issue is that the debug version works perfectly fine and shows the map, however when I published the release version in Play Store Google Maps doesn't show anything. – Núria Bosch Jan 07 '18 at 11:00
  • 1
    Go to your res/values folder and check if there is any `google-maps-api.xml` exist or not for release build. If not then copy your debug `res/values /google-maps-api.xml` to release res/values folder and don't forget to change the debug api key. – Nazmul Haque Jan 07 '18 at 11:04
  • @NazmulHaque I've already done that, and both debug and release folder have the correct API typed in. Doesn't work either. Now my question is, do I need to different API keys? I have one API key but with to fingerprints (one for debug and another for release) – Núria Bosch Jan 07 '18 at 11:10
  • You need one api key for debug and release (I have used only one api key for my app). I am not sure what exactly the problem but check your SHA1 fingerprints again and here is a [link](https://stackoverflow.com/questions/15727912/sha-1-fingerprint-of-keystore-certificate/35308827#35308827) i hope it will help @NúriaBosch – Nazmul Haque Jan 07 '18 at 11:23
  • @NazmulHaque Thankyou, I have a question. If I need two APIs for each apk, how do I type this APIs in Android Studio? Cause you have the google_map_api_xml debug and release folder but that's the same code for each of them. So, how do I program different apis in my Android Studio? – Núria Bosch Jan 07 '18 at 11:29
  • Check your `AndroidManifest.xml` file and you will see a `` tag and inside this tag your api key will be used. so if you change your build to debug `AndroidManifest.xml` will take the debug google map api key and if you change your build to release then `AndroidManifest.xml` will take the release google map api key. So you can use 2 api key one for release and one for debug. @NúriaBosch – Nazmul Haque Jan 07 '18 at 11:42
  • @NazmulHaque Sorry for being so stupid, but I still can't see where I must define and introduce both APIs, I have one of my APIs in my Manifest but then where do I type the second one? – Núria Bosch Jan 07 '18 at 11:45
  • Just open your `google-maps-api.xml` and you will see a `` tag. Inside this tag you just need to put your api key.If you have two api key (key1 for debug and key2 for release) then copy your api key1 and paste it to `google-maps-api.xml` file inside `` tag for debug build and for release build again copy the key2 and paste it to `google-maps-api.xml` .`AndroidManifest.xml` will automatically detect the key according to the build type.@NúriaBosch – Nazmul Haque Jan 07 '18 at 11:59
  • @NazmulHaque Just tried that, I'm afraid it doesn't work either. Do you have any idea as to what is causing this issue? – Núria Bosch Jan 07 '18 at 12:21
  • I have no idea whats the problem. If you have time try to make another project for testing.@NúriaBosch – Nazmul Haque Jan 08 '18 at 07:50
  • Have you seen this answer: https://stackoverflow.com/a/44672565/5140781? – xomena Jan 25 '18 at 12:22

0 Answers0