Fix LeakCanary plugin UI, Upgrade LC dependency and make it compile only (#3367)

Summary:
**Currently, the Leak Canary plugins is broken, see this screenshot (unable to expand):**
<img width="1359" alt="Screen Shot 2022-01-29 at 2 06 33 PM" src="https://user-images.githubusercontent.com/745166/151679662-9d8e8eb6-c19c-4008-9821-1c2c1af92351.png">

**This fix repairs and improves the UI:**
<img width="1350" alt="Screen Shot 2022-01-29 at 2 06 03 PM" src="https://user-images.githubusercontent.com/745166/151679677-7965604c-dd04-4ee5-bc8e-d53a82da1bd7.png">

## Changelog

- Fixes UI to enable showing leak trace
- Upgrades LackCanary dependency from 2.6 to 2.8.1
- Makes Kotlin and LC `compileOnly` dependencies in order to prevent conflict for the users
- Updates documentation

Pull Request resolved: https://github.com/facebook/flipper/pull/3367

Test Plan:
See demo at https://github.com/hbmartin/leakcanary/tree/flipper-demo/leakcanary-android-sample

**Static Docs Preview: flipper**
|[Full Site](https://our.intern.facebook.com/intern/staticdocs/eph/D33915179/V3/flipper/)|

|**Modified Pages**|

Reviewed By: passy

Differential Revision: D33915179

Pulled By: cekkaewnumchai

fbshipit-source-id: 9698dba23ab475c8cd84e4c222dfc41712b05a1e
This commit is contained in:
Harold Martin
2022-02-03 01:36:25 -08:00
committed by Facebook GitHub Bot
parent 6bd134d624
commit cdb72db5a9
4 changed files with 7 additions and 7 deletions

View File

@@ -20,9 +20,9 @@ android {
} }
dependencies { dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$KOTLIN_VERSION" compileOnly "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$KOTLIN_VERSION"
implementation project(':android') implementation project(':android')
implementation deps.leakcanary2 compileOnly deps.leakcanary2
compileOnly deps.jsr305 compileOnly deps.jsr305
} }
} }

View File

@@ -96,7 +96,7 @@ ext.deps = [
mockito : 'org.mockito:mockito-core:4.3.1', mockito : 'org.mockito:mockito-core:4.3.1',
okhttp3 : 'com.squareup.okhttp3:okhttp:4.9.3', okhttp3 : 'com.squareup.okhttp3:okhttp:4.9.3',
leakcanary : 'com.squareup.leakcanary:leakcanary-android:1.6.3', leakcanary : 'com.squareup.leakcanary:leakcanary-android:1.6.3',
leakcanary2 : 'com.squareup.leakcanary:leakcanary-android:2.6', leakcanary2 : 'com.squareup.leakcanary:leakcanary-android:2.8.1',
protobuf : 'com.google.protobuf:protobuf-java:3.19.4', protobuf : 'com.google.protobuf:protobuf-java:3.19.4',
testCore : 'androidx.test:core:1.4.0', testCore : 'androidx.test:core:1.4.0',
testRules : 'androidx.test:rules:1.4.0', testRules : 'androidx.test:rules:1.4.0',

View File

@@ -4,7 +4,7 @@ Ensure that you already have an explicit dependency in your application's
```groovy ```groovy
dependencies { dependencies {
debugImplementation 'com.facebook.flipper:flipper-leakcanary2-plugin:0.132.0' debugImplementation 'com.facebook.flipper:flipper-leakcanary2-plugin:0.132.0'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.6' debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.8.1'
} }
``` ```
@@ -18,7 +18,6 @@ import com.facebook.flipper.plugins.leakcanary2.LeakCanary2FlipperPlugin
override fun onCreate() { override fun onCreate() {
super.onCreate() super.onCreate()
setupFlipper()
/* /*
set the flipper listener in leak canary config set the flipper listener in leak canary config

View File

@@ -232,10 +232,10 @@ export default class LeakCanary<PersistedState> extends FlipperPlugin<
return ( return (
<Panel <Panel
key={idx} key={idx}
collapsable={false} collapsable
padded={false} padded={false}
heading={leak.title} heading={leak.title}
floating={false} floating
accessory={leak.retainedSize}> accessory={leak.retainedSize}>
<ElementsInspector <ElementsInspector
onElementSelected={(eid) => { onElementSelected={(eid) => {
@@ -249,6 +249,7 @@ export default class LeakCanary<PersistedState> extends FlipperPlugin<
searchResults={null} searchResults={null}
root={leak.root} root={leak.root}
elements={elements} elements={elements}
scrollable={false}
/> />
</Panel> </Panel>
); );