Ashok-Varma/Gander

No-op has no Android AAC Lifecycle extensions transitive dependency

BaloghTamas opened this issue · 4 comments

The debug version has androidx.lifecycle:lifecycle-extensions:$version" as a transitive dependency, but the no-op don't. I have faced an issue, where I forgot to include that dependency in my project, it worked in debug mode, but in release it failed.

That would be nice to have the same transitive dependencies for each type, even if it is not used, otherwise it is a bug that is really hard to track down.

Hi @BaloghTamas which version are you using ?
because in recent versions only okhttp3 was transitive com.squareup.okhttp3:okhttp:.
Is it happening in latest versoin

I am using 1.4.0 right now, but as I see it is still an issue for the recent 3.1.0.

Yes, the no-op only uses okhttp3 as transitive dependency, this is the root of the issue.

If you define gander as debugImplementation dependency, and gander-no-op as a releaseImplementation dependency, which is quite common, the two different build type will have different transitive dependencies. This can lead to issues like I have faced.
I was using AAC Viewmodel, but forgot to include lifecycle-extensions, but with Gander it was resolved transitively, however, when I have built a release version, I had issues about ViewModelProviders and so, which is the part of the lifecycle-extensions. It took a while to figure out it is about Gander. I hope we can save others from that by including the same transitive dependencies for both gander, and gander no-op. If the user don't use them proguard would strip them, if uses then we save some headache I guess.

Debug version dependencies

dependencies {
    api "com.squareup.okhttp3:okhttp:$okhttp3Version"

    implementation "com.google.android.material:material:$materialComponentsVersion"
    implementation "androidx.appcompat:appcompat:$appCompatVersion"

    implementation "androidx.paging:paging-runtime:$pagingVersion"
    implementation "androidx.lifecycle:lifecycle-extensions:$lifeCycleVersion"
}

from:
https://github.com/Ashok-Varma/Gander/blob/3.1.0/gander/build.gradle

Release version dependencies (no-op)

dependencies {
    api "com.squareup.okhttp3:okhttp:$okhttp3Version"
}

from:
https://github.com/Ashok-Varma/Gander/blob/3.1.0/gander-no-op/build.gradle

now all the transitive dependencies are removed from both debug and release except okhttp.
So even the release should not send any transitive dependencies it should be up to clients to use whatever they need.

You can verify using latest library except okhttp, other transitive dependencies will be gone now in both no-op and normal version

Ok I am going to check that, until then I close the issue, reopen if still exists