简体   繁体   中英

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 xxxx address, while there is a production server under the yyyy 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, eg? Alternatively, is there a programmatic way to check in which environment the app is? This way I could myself decide which config to take.

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/

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM