1

I have a 'mobile' module that depends on a 'core' module, and I keep getting the same inconsistent error:

mobile/build.gradle:

    debug {
        buildConfigField "String", "URL_SEARCH", "\"https://mobile.debug\""
    }
    release {
        buildConfigField "String", "URL_SEARCH", "\"https://mobile.release\""
    }

core/build.gradle:

    debug {
        buildConfigField "String", "URL_SEARCH", "\"https://core.debug\""
    }

    release {
        buildConfigField "String", "URL_SEARCH", "\"https://core.release\""
    }

Whenever I set my variants to be mobile debug + core debug, I still get the same output inside my core.MyApplication.java file: 'https://core.release':

mobile+core in debug variant

Kamilski81
  • 14,409
  • 33
  • 108
  • 161

1 Answers1

2

Whenever your modules imports another dependency-module, the dependency-module uses it's 'release' variant.

See: BuildConfig.DEBUG always false when building library projects with gradle

The solution for this is to use your com.main.module.BuildConfig.DEBUG variables, and not your com.dependency-module.BuildConfig.DEBUG...cause this debug will always be false.

Community
  • 1
  • 1
Kamilski81
  • 14,409
  • 33
  • 108
  • 161