Files
flipper/docs/setup/leak-canary-plugin.md
Bhaskar gyan vardhan 36689add82 Update leak-canary-plugin.md (#519)
Summary:
Unexpected semicolon in refWatcher sample code

copy pasting the sample code for refWatcher giving below error due to a semicolon in refWatcher code
![image](https://user-images.githubusercontent.com/10504808/63110022-25236b80-bfa8-11e9-8756-c95afc7d68a9.png)

## Changelog

remove the semicolon from refWatcher sample code
Pull Request resolved: https://github.com/facebook/flipper/pull/519

Reviewed By: danielbuechele

Differential Revision: D17527312

Pulled By: passy

fbshipit-source-id: c573736dec63de2e93113b56c24a7bab72bb0067
2019-09-24 09:53:08 -07:00

1.1 KiB

id, title, sidebar_label
id title sidebar_label
leak-canary-plugin LeakCanary Setup LeakCanary

Ensure that you already have an explicit dependency in your application's build.gradle, e.g.

dependencies {
  debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.1'
  releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.1'
}

First, add the plugin to your Flipper client instance:

import com.facebook.flipper.plugins.leakcanary.LeakCanaryFlipperPlugin;

client.addPlugin(new LeakCanaryFlipperPlugin());

Next, build a custom RefWatcher using RecordLeakService: (see LeakCanary docs for more information on RefWatcher)

import com.facebook.flipper.plugins.leakcanary.RecordLeakService;

RefWatcher refWatcher = LeakCanary.refWatcher(this)
    .listenerServiceClass(RecordLeakService.class)
    .buildAndInstall();

Then, add the RecordLeakService in your debug variant AndroidManifest.xml.

<service android:name="com.facebook.flipper.plugins.leakcanary.RecordLeakService" />