Solve the problem that LeakCanary 2.4 version does not support release

LeakCanary is a tool for detecting memory leaks. The version used in the original project is: com.squareup.leakcanary:leakcanary-android:1.6.2, which supports both debug and release package compilation methods.
After upgrading to the com.squareup.leakcanary:leakcanary-android:2.4 version, only the debug compilation method is supported, and the app will crash during release.
How can we support the release method? The official solution:
create a new xml file in the res/values ​​directory:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <bool name="leak_canary_allow_in_non_debuggable_build">true</bool>
</resources>

Recompilation can support the release compilation method.

Guess you like

Origin blog.csdn.net/chenzhengfeng/article/details/108328400