You can put your code as follows:
if(BuildConfig.DEBUG){ ... //debug init } else { ....//release init }
OR
1) Create a project structure as follows:

2) Gradle flavors:
productFlavors { driver { applicationId "android.com.driver" versionName "1.0" buildConfigField "Boolean", "DRIVER_SESSION", "true" minSdkVersion 16 targetSdkVersion 23 } passenger { applicationId "android.com.passenger" versionName "1.0" buildConfigField "Boolean", "DRIVER_SESSION", "false" minSdkVersion 16 targetSdkVersion 23 } } sourceSets { passenger { manifest.srcFile 'src/passenger/AndroidManifest.xml' } driver { manifest.srcFile 'src/driver/AndroidManifest.xml' } }
3) You need to create differents classes and put the application name for each manifest file:
manifest in driver package β
<application android:name=".application.YourFirstAppInDriverPackage" ... >
appears in the passenger package β
<application android:name=".application.YourSecondAppInPassengerPackage" ... >
4) Switch the development mode between two projects:

source share