0
I have some constants which I would like to vary according to how BuildType
of Gradle. Among them are the URL’s of the API’s that I use in my app, which can be production, homologation and development. For example:
https://api.empresa.com.br and http://dev.api.empresa.com.br
I’ve read the documentation, and have tried solutions from here and from here. But none worked.
What is the correct `build.Gradle configuration so I don’t have to manually change my constants according to the environment.
Great Neto! Thanks for the link, helped me to identify the problem, but the author was very mistaken in the example of use of Build Variants. According to official documentation, only Buildtype is enough to solve the problem of environments, the
Flavors
is to create alternative versions of the app as Paid and Free, where each of them will have the version dev and Prod. It doesn’t make any sense to have Flavors Productiondebug or Stagingrelease– Androiderson
Really Flavors is a little bit more than the task if it’s just for some environment variables. I’m glad you found the solution.
– Neto Marin