New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update version of lifecycle-viewmodel dependency that LeakCanary compiles against #2483
Comments
@mauriciogg Can you open a PR? Would be much easier if you come up with the fix for your specific issue that you know works |
|
What issues? Does the generated bytecode end up not being compatible with older versions of the lifecycle library? |
Different version of the kotlin compiler used to compile the lib: I'm updating
I'm not super familiar with gradle so I might not be doing the right thing though. |
ah so looks like we'd need to bump the kotlin version of LeakCanary first, which implies new major release. That's something I do want to do but it'll take time. |
Description
Hello,
We are encountering an issue related to #2314 that manifest itself as a build issue rather than a runtime issue when building with Bazel as opposed to Gradle so 2108693 does not fix the issue.
Under bazel there is an extra check to ensure that desugaring wont result in runtime issues like the one fixed in 2108693. This is a tricky one to fix on the build system since
com.squareup.leakcanary:leakcanary-object-watcher-android-androidx
does not declare any dependency on androidx (i understand this is the correct behavior). Because of this, we have to possible solutions: 1) manually craft the target for leakcanary we use in bazel to depend on the androidx library or 2) disable the checks alltogether. Both are undesirable for different reasons.Wouldnt adding a default implementation for
create(modelClass, extras
that simply callscreate(modelClass)
here fix the issue both at build time and runtime?Can #2314 be reopened?
Steps to Reproduce
Building an
android_binary
target in bazel that depends onandroidx.lifecycle:lifecycle-viewmodel (version >= 2.5.1)
/@mvn//:androidx_lifecycle_lifecycle_viewmodel
com.squareup.leakcanary:leakcanary_android_core
/@mvn//:com_squareup_leakcanary_leakcanary_android_core
will result in the following failure:
singlejar_local: androidx/lifecycle/ViewModelProvider$Factory needed on the classpath for desugaring leakcanary/internal/ViewModelClearedWatcher$Companion$install$provider$1. Please add the missing dependency to the target containing the latter.
Expected behavior: [What you expect to happen]
Build succeeds
Version Information
The text was updated successfully, but these errors were encountered: