JakeWharton / hugo

Annotation-triggered method call logging for your debug builds.
Apache License 2.0
7.92k stars 797 forks source link

App debug variants are not handled properly #143

Open riyaz opened 7 years ago

riyaz commented 7 years ago

If your app exceeds 65K limit and you use new variant just for development purpose, Hugo might not work properly, reason being in HugoPlugin.groovy only debugCompile is added as dependency.

Workwround is to manually add dependency in your build.gradle like below if suppose devBuild is your variant you want to enable Hugo then add like below

dependencies {
  devBuildCompile 'com.jakewharton.hugo:hugo-runtime:1.2.1'
}
wangying3426 commented 7 years ago

+1

wangying3426 commented 7 years ago

Our project has two subprojects, main and base, and main depends upon base. When I execute ./gradlew :main:assembleDebug, :base:bundleRelease will be executed. So hugo-runtime library will not be packed in.

martijndebruijn commented 7 years ago

+1

NikitaKozlov commented 7 years ago

The problem has nothing todo with Hugo. It is the way Gradle resolves dependencies, from gradle docs:

By default a library only publishes its release variant. This variant will be used by all projects referencing the library, no matter which variant they build themselves. This is a temporary limitation due to Gradle limitations that we are working towards removing.

You need to allow library to publish its debug variant by adding this code into library's build.gradle file:

android {
    defaultConfig {
        defaultPublishConfig 'release'
        publishNonDefault true
    }
}

Then force the module that depends on your library to grab debug version in debug build:

dependencies {
    debugCompile project(path: ':app2', configuration: "debug")
    releaseCompile project(path: ':app2', configuration: "release")
}

For more info check Gradle docs.