Search code examples
androidkotlinjunitleakcanary

LeakCanary is currently disabled: test class org.junit.Test was found in classpath


I added LeakCanary library to my project and i got this error message : LeakCanary is currently disabled: test class org.junit.Test was found in classpath.

I found an answer which include this code part:

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

But i don't know that where to put this.

I add this in my build.gradle but problem can not solved.

configurations {
    debugImplementation.exclude group: "junit", module: "junit"
} 

Solution

  • To prevent interference during test execution, LeakCanary will be disabled for test build. For Unit testing, you better create separate module.