11

In my app I'm using google maps. Now, I realized that you have a build google maps key and release google maps key. When I launch my signed apk into the app store for testing the google maps screen goes grey. And i have to keep signing a new apk and loading it into play store and then test it.

How do I test a release build? Please provide very simple and easy step by step instructions or if you know how to solve the problem with google maps that would be helpful.

Here is a screen shot of how i set up my google maps api in the console for my release one.

enter image description here

Zoe
  • 23,712
  • 16
  • 99
  • 132
TheQ
  • 1,770
  • 6
  • 33
  • 60
  • `Have to keep signing a new apk and loading it into play store and then test it` you can define which your gradle > http://stackoverflow.com/a/18776949/5188159 – Charuක Feb 14 '17 at 04:52
  • do you need the answer for your gray screen as well ;) – Charuක Feb 14 '17 at 05:06
  • @Charuක hi there, so i just solved it actually (im having some luck here in the last 20mins). But, what i did was make a new key, and i made it completely open. Then, i went to project view. app->src->release->res->values-> google_maps_api and i entered that new key that had no restrictions. and it ended up working (in the release build). Did you have another (or better) way? – TheQ Feb 14 '17 at 05:14
  • yes that was i mentioning if you forgot to add that key in your release google map it goes gray at release mode – Charuක Feb 14 '17 at 05:18
  • @Charuක oh im sorry, it was hidden for some reason. But thank you, for the solution! – TheQ Feb 14 '17 at 05:21
  • Okay good luck :D – Charuක Feb 14 '17 at 05:22

2 Answers2

19

Test a release build

enter image description here

  1. open Build Variants

enter image description here

  1. set debug to release

  2. Build and Run

For gray screen Once you have got the release SHA set in dev console

  • This is main reason that I forget most of the time

You have two google_maps_api.xml files

One in this folder:

app/src/debug/res/values

Other in this folder:

app/src/release/res/values

But only the debug one contains your API key probably.

enter image description here

Charuක
  • 12,229
  • 5
  • 43
  • 83
1

You can use gradle tasks to run a release build on emulator.

Default task name is installRelease

just start emulator and fire below command from terminal

./gradlew installRelease

this will install release build into emulator.

Nayan Srivastava
  • 3,298
  • 3
  • 24
  • 47