I have two flavors in my Android project, one works with test server and one with production. I store the URL inside a string resource, so I may access the correct URL based on a flavor that I choose for compilation. Usually I need to create multiple apk files during a day, each time for both servers.
Is there a way to create two apk files each time I run my project or build an apk from Build menu?
If you have something like this:
android {
productFlavors {
dev {
applicationId "your.com.android.devel"
buildConfigField 'String', 'HOST', '"http://192.168.1.78"'
}
prod {
applicationId "your.com.android"
buildConfigField 'String', 'HOST', '"http://yourserver.com"'
}
}
}
You only have to run assemble in Gradle projects
And you can find all the different apks build/outputs/apk
Hope this time I'd be more helpful
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With