How to Integrate Android Pluto into Your Application

Nov 21, 2022 | Programming

Android Pluto is an innovative on-device debugging framework that provides developers with essential tools to inspect HTTP requests and responses, capture crashes and ANRs (Application Not Responding), and manipulate application data in real-time. In this guide, we’ll walk you through integrating Pluto into your Android application step by step.

1. Add Gradle Dependencies

Pluto is distributed via mavenCentral. To get started, you need to add the appropriate Gradle dependencies to the build.gradle file of your app module. Make sure to include both the regular Pluto and the “no-op” variant to keep the release build free of debugging code.

def plutoVersion = 2.2.1
dependencies {
   ...
   debugImplementation "com.plutolib:pluto:$plutoVersion"
   releaseImplementation "com.plutolib:pluto-no-op:$plutoVersion"
   ...
}

2. Initialize Pluto

To begin using Pluto, initialize the SDK from your application class. You will need to pass the application context to it.

Pluto.Installer(this)
  .addPlugin(....)  // Add any required plugins here
  .install()

3. Install Plugins

Pluto now allows flexibility in adding debuggers either as a bundle or individually. Here’s how to include both:

3.1 Using Plugin Bundle

If you want a ready-made solution, include the plugin bundle that comes with all basic plugins.

dependencies {
   ...
   debugImplementation "com.plutolib.plugins:bundle-core:$plutoVersion"
   releaseImplementation "com.plutolib.plugins:bundle-core-no-op:$plutoVersion"
   ...
}

3.2 Using Individual Plugins

If you’re interested in specific debugging capabilities, add individual plugins based on your needs. Here’s a list:

Reference their README files for integration steps.

4. Grouping Plugins (Optional)

For better readability, you can group similar plugins together. Here’s a sample of how to create a group:

class DataSourcePluginGroup : PluginGroup("datasource-group") {
    override fun getConfig() = PluginGroupConfiguration("Data Source Group")
    override fun getPlugins() = listOf(
        PlutoSharePreferencesPlugin(),
        PlutoDatastorePreferencesPlugin(),
        PlutoRoomsDatabasePlugin()
    )
}

Then, add the group using the installer:

Pluto.Installer(this)
    .addPluginGroup(DataSourcePluginGroup())
    .install()

5. Troubleshooting

During the integration process, you may encounter some issues. Here are some troubleshooting tips:

  • Ensure that you have the correct dependencies specified in your build.gradle file.
  • Double-check that you are initializing Pluto properly in your application class.
  • Make sure the plugins you’re trying to install are compatible with the Pluto version you are using.

For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

Conclusion

Now that you have integrated Android Pluto into your application, rebuild and run your app. You should receive a notification from Pluto, which you can use to access the Pluto UI and leverage its debugging capabilities.

At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox