Skip to content

Latest commit

 

History

History
 
 

exceptions

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Integrate Exceptions Plugin in your application

Add Gradle Dependencies

Pluto Exceptions is distributed through mavenCentral. To use it, you need to add the following Gradle dependency to your build.gradle file of you android app module.

Note: add the no-op variant to isolate the plugin from release builds.

dependencies {
  debugImplementation 'com.plutolib.plugins:exceptions:2.0.1-beta'
  releaseImplementation 'com.plutolib.plugins:exceptions-no-op:2.0.1-beta'
}

Install plugin to Pluto

Now to start using the plugin, add it to Pluto

Pluto.Installer(this)
  .addPlugin(PlutoExceptionsPlugin("exceptions"))
  .install()

Set Global Exception Handler

To intercept uncaught exceptions in your app, attach UncaughtExceptionHandler to PlutoExceptions

PlutoExceptions.setExceptionHandler { thread, throwable ->
    Log.d("exception_demo", "uncaught exception handled on thread: " + thread.name, throwable)
}

To intercept & report potential ANRs in your app, attach UncaughtANRHandler to PlutoExceptions

PlutoExceptions.setANRHandler { thread, exception ->
    Log.d("anr_demo", "potential ANR detected on thread: " + thread.name, exception)
}

🎉  You are all done!

Now re-build and run your app and open Pluto, you will see the Exceptions plugin installed.