leakcanary: Heap analysis failed for Obfuscated App
Description
I ran the app from android studio setting up LeakCanary for obfuscated apps and it failed during heap analysis. I turned off obfuscation in progaurd-rules.pro
and it worked.
m.d
at shark.c$o$a.a()
at shark.c$o$a.a()
at shark.q0.a()
at shark.c$o.a()
at shark.o.a()
at shark.o.a()
at shark.o.a()
at shark.o.a()
at shark.o.a()
at leakcanary.internal.HeapAnalyzerService.a()
at leakcanary.internal.HeapAnalyzerService.a()
at leakcanary.internal.i.onHandleIntent()
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:66)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.os.HandlerThread.run(HandlerThread.java:61)
Build.VERSION.SDK_INT: 23
Build.MANUFACTURER: LGE
LeakCanary version: 2.2
Analysis duration: 75543 ms
Heap dump file path: /storage/emulated/0/Download/leakcanary-com.colevit.furmate/2020-04-25_23-53-20_181.hprof
Heap dump timestamp: 1587839082676
Steps to Reproduce
hprof: 2020-04-25_23-53-20_181.hprof.zip
Expected behavior: It should analyse the heap and show leak trace with de-obfuscated names.
Version Information
- LeakCanary version: 2.2
- Android OS version: 23
- Gradle version: 5.6.4
- Android Gradle plugin version: 3.5.3
Additional Information
This is tested on a release build though I also tested on debug build as well with code obfuscation and it failed.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 36 (19 by maintainers)
@Guneetgstar you just ran into a new check that will ship in the next release: https://github.com/square/leakcanary/pull/1806 (cc @cketti). We added this because Amazon Music shipped LeakCanary on the app store.
The doc hasn’t been updated yet, but here’s the latest from master: https://github.com/square/leakcanary/blob/master/docs/recipes.md#leakcanary-in-release-builds
TL;DR: add this:
Sure: https://github.com/square/leakcanary/issues/1925
Closing, looks like we’ve solved both issues (support fragment inspector triggering for no reason & mapping file not included)
Thank you for checking! I haven’t tested it with app bundles. I’ll check if we can make it work with aab. In the meantime I pushed a change that improves plugin initialization, so you may check the snapshot build when it’s merged.
so, it really looks like the mFragmentManager field can’t be found, which would imply that there’s a bug in how LeakCanary deobfuscate the field. I’m not sure where to go from here (cc @mzgreen )