class not found exception
mohamadk opened this issue · 1 comments
mohamadk commented
Description
Not sure why this is happening, but it looks like Leakcanaray cannot access a class in kotlin stdlib.
I checked the apk for both test and target both contain the class.
Steps to Reproduce
Just run the UI test "mainActivityTest"
Expected behavior: [What you expect to happen]
FATAL EXCEPTION: main
Process: com.example.leakcannarytest.test, PID: 15936
java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/jvm/internal/Intrinsics;
at leakcanary.internal.LeakCanaryFileProvider.attachInfo(Unknown Source:2)
at android.app.ActivityThread.installProvider(ActivityThread.java:7462)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6973)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6744)
at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2133)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7872)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
Caused by: java.lang.ClassNotFoundException: Didn't find class "kotlin.jvm.internal.Intrinsics" on path: DexPathList[[zip file "/data/app/~~GUpRtuj-dqptle4fIJmvEA==/com.example.leakcannarytest.test-6Wj6gDyxFb2hP5cmjdYgFA==/base.apk"],nativeLibraryDirectories=[/data/app/~~GUpRtuj-dqptle4fIJmvEA==/com.example.leakcannarytest.test-6Wj6gDyxFb2hP5cmjdYgFA==/lib/arm64, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at leakcanary.internal.LeakCanaryFileProvider.attachInfo(Unknown Source:2)
at android.app.ActivityThread.installProvider(ActivityThread.java:7462)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6973)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6744)
at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2133)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7872)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
Version Information
- LeakCanary version: 2.10
- Android OS version: 33
- Gradle version: 8
pyricau commented
Thanks for the bug report with a project that reproduces the issue. I was able to confirm the issue goes away when you add debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.10'
, I didn't think to document this because projects are typically already using LeakCanary when they start adding leak detection in tests. Here's a PR that adds it: mohamadk/leakcanaryTest#1
I updated the docs: https://square.github.io/leakcanary/ui-tests/#getting-started