I'm developing one of my first Android apps. I come from an ASP.NET world where it's trivial to have separate Web.config files for dev, test, and production. Does anyone have a good, automated way of doing this for Android via Eclipse?
Asked
Active
Viewed 1,341 times
3
-
I should clarify, what I'm looking for is a good automated way of maintaining separate res/values/*.xml files for dev, test, and production. – Rohan Singh Aug 29 '10 at 04:22
-
Take a look at this question: http://stackoverflow.com/q/1743683/214184 It worked out great for me. – slowpoison Oct 11 '11 at 00:44
2 Answers
1
I know question is late, but I will answer.
For have separate build for 'dev', 'test', 'production' you may use Gradle.
In build.gradle file you may define separate buildTypes
like this:
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable false
versionNameSuffix "r"
}
debug {
versionNameSuffix "d"
debuggable true
}
test {
applicationIdSuffix ".test"
versionNameSuffix "t"
debuggable false
}
The above snippet achieves the following:
- config release, debug, and test builds
- set
versionNameSuffix
to refer to the version string which is build - set
applicationIdSuffix
for may install test and release build on one device - and most usefull Gradle Build Types can contribute to the build with resources: src/[buildtypename]/res. So you can have separate resource for separate builds.
For more info go to http://tools.android.com/tech-docs/new-build-system/user-guide

Gwaeron
- 81
- 8
1
Have a command line ant based build system that takes "dev", "test", "production" as parameters and copies in the appropriate xml files for the build. This assumes that you already have a set of xml/config files for them.

omermuhammed
- 7,365
- 4
- 27
- 40