ANR-Detection

Setup – Android Part

To integrate the ANR-Detection plugin into your Android application, follow these steps:

  1. Add the JitPack repository to your project’s build.gradle:

maven { url = uri("https://jitpack.io") }

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven { url = uri("https://jitpack.io") }
    }
}
  1. Add the ANR-Detection plugin as a dependency in your app’s build.gradle:

dependencies {
  debugImplementation("com.github.allen-hsu:anrdetection:1.0.1")
}
  1. In your Application class, initialize the ANR-Detection plugin:

import com.allenhsu.flipper.anrdetection.ANRDetectionFlipperPlugin

class MyApplication : Application() {
    override fun onCreate() {
      super.onCreate()
      SoLoader.init(this, false)
      val client = AndroidFlipperClient.getInstance(this)
      /*
      add ANR-Detection plugin to flipper
      */
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
        client.addPlugin(ANRDetectionFlipperPlugin(this))
      }
      client.start()
    }
}

Setup – Flipper Desktop

To use the plugin with Flipper Desktop:

  1. Open Flipper Desktop and navigate to the Plugin Manager. 截圖 2023-11-08 下午5 31 58
  2. Search for anr-detection and install the plugin.
  3. Once installed, the ANR detection tab will be available on the left sidebar in Flipper Desktop. 截圖 2023-11-08 下午5 33 11

GitHub

View Github