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

1 Answer 1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.