Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

428
Views
Can't use LeakCanary because of org.junit.Test class dependency in external libraries

I'm trying to use LeakCanary for finding memory leaks in my Android application. I'm using Android Studio.

When I start debugging my application I see "LeakCanary is currently disabled: test class org.junit.Test was found in classpath." message.

"org.junit.test" class came from external library.

How can I force enable LeakCanary?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

LeakCanary automatically disables itself in tests by detecting that the org.junit.Test is in the classpath. Unfortunately, some apps ship Junit in their app debug classpath (e.g. when using OkHttp MockWebServer). You can customize which class is used to detect tests:

<resources>
  <string name="leak_canary_test_class_name">assertk.Assert</string>
</resources>

The doc needs to be updated (tracked here: https://github.com/square/leakcanary/issues/1968)

over 4 years ago · Santiago Trujillo Report

0

Sometimes it helps to check your module build.gradle file and find "implementation" instead of "testImplementation" or "androidTestImplementation" for test dependencies. It may cause this issue.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!