Distinguishing between testing and formal environment in Android packaging

preface

This article mainly introduces the relevant contents of distinguishing between testing and formal environment in Android packaging, which can be shared for your reference and learning. I won't say more below. Let's take a look at the detailed introduction together:

Apk packaging formal environment and test environment note

Recently, I encountered a problem in project packaging. Every time I package, I have to distinguish between the officially released package and the test version package, mainly to modify the configuration

When the variable is true, it is the formal package, otherwise it is the test package. Every time I go online, I remind myself to be careful. I can't make mistakes. However, my feet are finally wet. When a channel is packaged, I forget to modify it, resulting in a fine

However, people are people. You can't remember every time. At this time, you should think of a way to decide whether the formal package or the test package is based on whether you are the release version or the debug version.

First, add the following configuration to your build. Gradle file

Then assign values to the variables that you need to control whether the test package is formal or not

So as long as you choose when packing

In this way, we can dynamically distinguish between formal and tested packages

For the build.gradle configuration, refer to: https://www.oudahe.com/p/38801/

summary

The above is the whole content of this article. I hope the content of this article has a certain reference value for your study or work. If you have any questions, you can leave a message. Thank you for your support for programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>