0

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.

jotaEsse
  • 261
  • 2
  • 18

2 Answers2

1

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/

Axiom
  • 88
  • 1
  • 6
  • Vote Up for the tutorial! I've read it and flavors seem really handy, with a lot of features. I've just missed one detail: will I need to deploy one apk for each flavor separately? Of course, this will already help me, since I won't need to make any changes before deploying, but if I didn't misunderstood, the flavor affects the apk in compile time. Do you think there is a way to achieve that? For now, your answer is the closest to what I want to achieve, so I am putting it into practice and then accepting it. Glad to know about "flavors". – jotaEsse May 21 '15 at 14:08
  • @jotaEsse I think you can find the answer to your question here: http://tulipemoutarde.be/2013/10/06/gradle-build-variants-for-your-android-project.html I don't have an extensive experience with flavors unfortunately. – Axiom May 21 '15 at 14:48
0

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..

Anjali
  • 1
  • 1
  • 13
  • 20