How can I use a specific minSdkVersion only in a debug mode? I want to use the minSdkVersion 21 for debug mode, but minSdkVersion 15 for the release. I don't wanna use flavors for this because will give troubles.
I think the could be like this (but don't work):
defaultConfig {
applicationId "blacktoad.com.flapprototipo"
minSdkVersion 15
debug{
minSdkVersion 21
}
targetSdkVersion 23
versionCode 42
versionName "1.72"
multiDexEnabled true
}
You cant test if application package is signed with debug key. Debug key is automatically generated by Android SDK tools while you are developing application. One way is to obtain your debug key signature, hardcode it into your code, and then test if your application is signed with this key.
In recent versions of the Android Developer Tools (ADT) for Eclipse, there's a class called BuildConfig which is automatically generated by the build. This class is updated automatically by Android's build system (like the R class), and it contains a static final boolean called DEBUG, which is normally set to true.
There exist a better way to do it without Product Flavors or hooking into the build flow. Example:
buildTypes {
debug {
defaultConfig.minSdkVersion 19
defaultConfig.vectorDrawables.useSupportLibrary = true
defaultConfig.multiDexEnabled = true
...
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