I know this is probably a dumb question, but I am pretty new at developing android, and I currently experiencing an OutOfMemoryError in my apps, which I have tried to debug
Posting this answer because all other answers are no longer needed and there's a better way to find leaks on your app using Leak Canary 2.
Just add below dependency to your gradle. No more code needed.
debugImplementation 'com.squareup.leakcananry:leakcanary-android:2.2'