I would like to create a very simple task that changes the boolean value in my gradle configuration.
I am working on an Android application that can be run with multiple profiles, and for each build you need to indicate whether the application will fake Bluetooth in my code or not.
My gradle (corresponding code):
def fakeBluetooth = "true" buildTypes { debug { minifyEnabled false signingConfig android.signingConfigs.debug buildConfigField "boolean", "fakeBluetooth", fakeBluetooth } release { minifyEnabled true signingConfig android.signingConfigs.release buildConfigField "boolean", "fakeBluetooth", fakeBluetooth } } task noFakeBluetooth { fakeBluetooth = "false" }
Example usage in my java code:
if (BuildConfig.fakeBluetooth) { processFictiveBluetoothService(); } else { // other case }
Command line usage examples:
./gradlew iDebug noFakeBluetooth
and
./gradlew iDebug
Problem: in both cases, the fakeBluetooth value is always "true" (with or without "noFakeBluetooth" in the cmd line).
source share