-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed LeakCanary #5784
Merged
Merged
Fixed LeakCanary #5784
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
fe8dda0
Fixed LeakCanary
grzesiek2010 e1c9f15
Updated LeakCanary version
grzesiek2010 97450a6
Enable LeakCanary for selfSigned builds
grzesiek2010 e716552
Fixed lint
grzesiek2010 3d9e06c
Added a comment
grzesiek2010 ca64a56
Fixed class name used to detect test
grzesiek2010 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string name="leak_canary_test_class_name" translatable="false">assertk.Assert</string> | ||
<bool name="leak_canary_allow_in_non_debuggable_build">true</bool> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain how this fixes things? Might be worth a comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This enables LeakCanary. It was disabled with this message:
LeakCanary is currently disabled: test class org.junit.Test was found in classpath
and according to https://square.github.io/leakcanary/changelog/#api-breaking-bettering-changes this is how we need to fix it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. Not sure I get why we're using
assertk.Assert
as the test class to detect though? We don't use assertk as far as I'm aware.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding is that by default it looks for org.junit.Test and in our case it was found and LeakCanary was disabled.
With this line, it will look for
assertk.Assert
that does not exist so LeakCanary will be enabled.That's how I understand it but the documentation is poor and I'm not the only one complaining about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. But that will mean it also runs during tests right? My interpretation of those docs is that we should set
leak_canary_test_class_name
to a class that will only be present in tests (which would be the original intention oforg.junit.Test
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I used
androidx.test.ext.junit.runners.AndroidJUnit4
instead.