I would like to use different database files for debug and release builds. Is it possible to do it with using gradle and two different directories like assets and assets_deb for instance?
The verification code in the app, like this android.os.Debug.isDebuggerConnected()
is not suitable in my situation.
Thanks
You can use different assets folder, like:
app/src/main/assets
app/src/debug/assets
app/src/release/assets
Or you can define different src folders in the build.gradle
file:
sourceSets {
main.java.srcDirs = ['...']
main.res.srcDirs = ['...']
main.assets.srcDirs = ['...']
debug.assets.srcDirs = ['...']
flavor1.assets.srcDirs = ['...']
}
To check the "debug" value you can use the default BuildConfig.DEBUG
.
In the same way you can define your own boolean value:
buildTypes {
debug {
buildConfigField "boolean", "MYVALUE", "true"
}
release {
buildConfigField "boolean", "MYVALUE", "false"
}
}
The automatically-generated BuildConfig class
will contain the following fields based on the directive above:
public class BuildConfig {
// ... other generated fields ...
public static final boolean MYVALUE = false;
}
Yes, you can. Just create another folder in your src
folder as below:
-- src
----- debug
--------- assets
----- main
--------- assets
If you need something like different application name in Debug mode, you can define new res/value
folder in debug
folder as well.
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