You can easily integrate LeakCanary into UI tests by simply including a specific code that runs when the test is completed. LeakAssertions.assertNoLeaks() After the test is completed, if you are using Espresso, you should start leak detection with LeakCanary in the method annotated with After….