jotaEsse
jotaEsse

Reputation: 271

Can I provide different resources to alpha/beta/prod enviroment of an Android app?

I have an android app, which communicates to a server through HTTP requests. The server's address is defined in an XML resource file, under the folder res/values. There is a tag with the type="config" for it. I have different addresses for the server, based on its environment. For example, there is a server for tests under the x.x.x.x address, while there is a production server under the y.y.y.y address.

On the developers console, I uploaded an apk for the beta users, linked to the tests server. I would like to promote it to production, but I would need to generate a new apk file only with the update changing the server's URL.

Q: can I provide different resources for alpha, beta and production environments, without the need of a new apk release?

Would it be possible to add some /res/values-beta/ folder, e.g.? Alternatively, is there a programmatic way to check in which environment the app is? This way I could myself decide which config to take.

Upvotes: 0

Views: 921

Answers (2)

Anjali
Anjali

Reputation: 2535

Hi I was also Searching for the same from past so many days and I came to this tutorial:

https://medium.com/@rdsubhas/a-better-android-release-pipeline-7eca6d76f0da#.nwfl59qs0

This is using productFlavors to have different end points for alpha/Beta And Production apk wihtout having to upload the new apk.

Hope this help you.

If you have already find your solution then do share it here.

Thanks..

Upvotes: 0

Axiom
Axiom

Reputation: 88

As mentioned in the comments, you need to use build variants and build flavors. Here's a great tutorial on how to do it:

http://blog.robustastudio.com/mobile-development/android/building-multiple-editions-of-android-app-gradle/

Upvotes: 1

Related Questions