I'm wondering how to create different build configurations, having different constants for debug and release builds using Android Studio (things like, server addresses, API keys,…).
Asked
Active
Viewed 7,232 times
5
-
This really doesn't look like a duplicate of the indicated question. – cja Dec 04 '13 at 12:13
1 Answers
6
Edit the build.gradle
file in your module and add any of the following to your android{}
container.
signingConfigs {
release {
storeFile file("path relative to the root of the project")
storePassword "PASSWORD!"
keyAlias "projectname"
keyPassword "PASSWORD!"
}
}
buildTypes {
debug {
versionNameSuffix "-DEBUG"
packageNameSuffix ".debug"
}
release {
debuggable false
signingConfig signingConfigs.release
}
debugRelease.initWith(buildTypes.release)
debugRelease {
debuggable true
packageNameSuffix '.debugrelease'
signingConfig signingConfigs.release
}
}
}
This adds 3 build types (release, debugRelease and debug)
both release and debugRelease use the same keys and debugRelease is a copy of Release.

hoss
- 2,430
- 1
- 27
- 42
-
It was not exactly what I was looking for, but it was enough to point me in the right direction. – Tiago Fael Matos Jul 12 '13 at 01:27