ANR-Detection
Setup – Android Part
To integrate the ANR-Detection plugin into your Android application, follow these steps:
- 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") }
}
}
- Add the ANR-Detection plugin as a dependency in your app’s
build.gradle
:
dependencies {
debugImplementation("com.github.allen-hsu:anrdetection:1.0.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:
- Open Flipper Desktop and navigate to the Plugin Manager.
- Search for
anr-detection
and install the plugin. - Once installed, the ANR detection tab will be available on the left sidebar in Flipper Desktop.