Crash in non-debuggable builds - #1806
Conversation
pyricau
left a comment
There was a problem hiding this comment.
Left some feedback, but other than that I like the general direction!
What do I run to check this crashes as expected? Also, probably need to update the XML in the sample app?
|
|
||
| if (application.resources.getBoolean(R.bool.leak_canary_allow_in_non_debuggable_build)) { | ||
| // AppWatcher is disabled by default for non-debuggable builds, but we have a developer opt-in. | ||
| AppWatcher.config = AppWatcher.config.copy(enabled = true) |
There was a problem hiding this comment.
Oh, that's interesting! Hadn't thought of this, makes sense to reenable.
| If you're sure you want to include LeakCanary in a non-debuggable build, you can disable this | ||
| check by overriding the bool/leak_canary_allow_in_non_debuggable_build resource and setting | ||
| the value to 'true'. |
There was a problem hiding this comment.
I think it would be better to add a corresponding section in the Code recipes and have the error message point to that page with an anchor to a detailed description with xml snippet to copy&paste. Source code of those docs is located in /leakcanary/docs/recipes.md
There was a problem hiding this comment.
A link for just the last part on how to disable the runtime check? Or replace the whole message with a link?
|
PR updated.
The easiest way is manual testing. Setting up a release build of the sample app was painful. Adding
I added a code recipe with an XML snippet you can use to override the check during a manual test. I wouldn't modify the sample app in the repository because you don't want to encourage people to actually use this override. |
Armaxis
left a comment
There was a problem hiding this comment.
LGTM! Added couple comments related to wording.
|
Updated with suggested wording changes. |
|
|
||
| ## LeakCanary in release builds | ||
|
|
||
| We **do not recommend** including LeakCanary in your production build. To avoid accidentally including the `com.squareup.leakcanary:leakcanary-android` dependency in a release build, LeakCanary crashes during initialization if the APK is not debuggable. |
There was a problem hiding this comment.
nit: this says both "production" and "release". We should ideally pick one, as changing vocabulary can be confusing. Probably release?
There was a problem hiding this comment.
|
Thanks!! I'll merge and follow up with the wording nit. |
Crash in release builds (really, any APK without
android:debuggable="true"). Can be overridden by setting@bool/leak_canary_allow_in_non_debuggable_buildtotrue.Fixes #1804