Trying to speed up my manual testing on Android Emulator by not having to login and navigate to a specific page every time I deploy a new apk to the emulator. Need to make sure that a careless developer on the team cannot accidentally deploy a release to play store that allows skipping login (e.g., don't just uncomment code to skip login).
Current approach:
if (BuildConfig.DEBUG && BuildConfig.FLAVOR.equals("skiplogin")){
// use hard-coded username/token
}
If what you want is that the code don't run on release why don't you instead use BuildConfig.DEBUG?
if (BuildConfig.DEBUG && BuildConfig.mockLogin) {
// use hard-coded username/token
}
and in your gradle define
buildConfigField('boolean' , 'mockLogin', 'true')
in the case that the code makes it to production it won't run cause BuildConfig.DEBUG it's false when you do a release build, and you can't upload a debug build to play store cause it won't allow it.