1

I have two properties I am reading from a property file in my Android library e.g.


testURL=http://mytesturl.com
prodURL=http://myprodurl.com

This library is used by my Android App. I would like to build two variants of the Android app - one for test and one for Production. The only difference between the two variants is which URL to use e.g.


if(some_condition) 
    url=  testURL
else
    url= prodURL

I know the android-library plugin does not support productFlavor / buildTypes yet so I am wondering how to do this?

kellyfj
  • 6,586
  • 12
  • 45
  • 66

1 Answers1

1

How about overwriting your ressource file ?

You put a default URL in your library and create two different Application one for test and one for prod and you overwrite the ressource file with the correct value in each application. That's what I use for application branding depending on the customer, not sure it's the best solution in your case but it works.

Other solution : put a static constant TEST in you application and check wether you're in Test mode or not.

Morendo
  • 752
  • 1
  • 4
  • 23