How to run android app in release not in debug?

荒凉一梦 提交于 2020-07-20 08:27:12

问题


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.


回答1:


Test a release build

  1. open Build Variants

  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.




回答2:


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.



来源:https://stackoverflow.com/questions/42218027/how-to-run-android-app-in-release-not-in-debug

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!