Skip to content

theGlenn/flipper-android-no-op

Repository files navigation

flipper-android-no-op

No-op dependency when using Flipper Android in release mode.

GitHub Contribute

Getting started

In your build.gradle:

allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}
...

dependencies {
    //The important part
    def flipper_version = '0.191.1'
    debugImplementation "com.facebook.flipper:flipper:$flipper_version"
    debugImplementation "com.facebook.flipper:flipper-network-plugin:$flipper_version"
    debugImplementation "com.facebook.flipper:flipper-leakcanary2-plugin:$flipper_version"
    debugImplementation 'com.facebook.soloader:soloader:0.10.4'
    
    // debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.9.1'

    // Include `flipperandroidnoop` and  `soloadernoop` individually
    releaseImplementation 'com.github.theGlenn.flipper-android-no-op:flipperandroidnoop:0.11.4'
    releaseImplementation 'com.github.theGlenn.flipper-android-no-op:soloadernoop:0.11.4'

    // Includes both libraries
    releaseImplementation 'com.github.theGlenn:flipper-android-no-op:0.11.4'
}

In your Application class same as this :

public class MyApplication extends Application {

  @Override public void onCreate() {
    super.onCreate();
    SoLoader.init(this, false);

    if (BuildConfig.DEBUG && FlipperUtils.shouldEnableFlipper(this)) {
      final FlipperClient client = AndroidFlipperClient.getInstance(this);
      client.addPlugin(NetworkFlipperPlugin())
      client.addPlugin(new InspectorFlipperPlugin(this, DescriptorMapping.withDefaults()));
      client.start();
    }
  }
}