Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hyperion-Android: ServiceLoader can’t load custom Plugin

Tags:

android

kotlin

I faced an issue in Hyperion github. I want to add my custom item into Hyperion menu. As I figure out if I remove something from core-libs they would be removed successfully and vice versa. But if I add custom Plugin - nothing happens.

I've tried different versions of Hyperion it also does not affect the result.
Also, here what I've checked additionally:

  1. Proguard
  2. Imports
  3. Dependencies
  4. LayoutInspector
  5. Sources with debugging
  6. Packages
  7. Flavors
  8. Extract into a separate module
  9. @AutoService annotation
  10. set minifyEnabled false

Plugin:

import com.google.auto.service.AutoService
import com.willowtreeapps.hyperion.plugin.v1.Plugin
import com.willowtreeapps.hyperion.plugin.v1.PluginModule

@AutoService(Plugin::class)
class TestPlugin : Plugin() {
    override fun createPluginModule(): PluginModule? {
        return TestPluginModule()
    }
}

Module:

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.willowtreeapps.hyperion.plugin.v1.PluginModule


class TestPluginModule : PluginModule() {
    override fun createPluginView(layoutInflater: LayoutInflater, parent: ViewGroup): View? {
        return layoutInflater.inflate(R.layout.htest_plugin_item, parent, false)
    }
}

Dependencies:

def hyperionVersion = '0.9.27'
    debugImplementation "com.willowtreeapps.hyperion:hyperion-core:$hyperionVersion"
    debugImplementation "com.willowtreeapps.hyperion:hyperion-attr:$hyperionVersion"
    debugImplementation "com.willowtreeapps.hyperion:hyperion-crash:$hyperionVersion"
    debugImplementation "com.willowtreeapps.hyperion:hyperion-measurement:$hyperionVersion"
    debugImplementation "com.willowtreeapps.hyperion:hyperion-recorder:$hyperionVersion"
    debugImplementation "com.willowtreeapps.hyperion:hyperion-shared-preferences:$hyperionVersion"
    debugImplementation "com.willowtreeapps.hyperion:hyperion-timber:$hyperionVersion"

NOTE: on screenshots v0.9.26. But I've tested also v0.9.27, v0.9.25, v0.9.24.

like image 369
ardiien Avatar asked Dec 11 '19 13:12

ardiien


People also ask

How do I embed the Hyperion plugin menu into an activity?

Hyperion#open (Activity) will have no affect if Hyperion has not been enabled. You can reenable for future Activities with Hyperion.enable (). To embed the Hyperion Plugin Menu into your own Activity, acquire a PluginViewFactory from Hyperion#getPluginViewFactory and call create (Activity):

What is Hyperion and how do I use it?

Hyperion is a hidden plugin drawer that can easily be integrated into any app. The drawer sits discreetly under the app so that it is there when you need it and out of the way when you don't. Hyperion plugins are designed to make inspection of your app quick and simple. Please see our announcement blog post for a feature showcase.

How do I activate Hyperion on my Android device?

Once Hyperion is integrated into your app, simply shake your phone to activate. If you are running your app on an emulator, you can manually open the menu by calling Hyperion.open (Activity activity). You can also open the menu by selecting the foreground notification that appears while the client app is in the foreground.

How do I disable Hyperion in Android?

To disable for specific Activities, annotate them with @HyperionIgnore. To disable for all Activities, set a meta-data field in your AndroidManifest.xml: Hyperion#open (Activity) will have no affect if Hyperion has not been enabled.


1 Answers

it looks like the problem is related to the processing of @AutoService annotation. Make sure that you have added an annotation processor to the project.

You should add the following annotation processor to the build.gradle file.

for Kotlin project:

kapt 'com.google.auto.service:auto-service:1.0-rc6'

for Java project:

annotationProcessor 'com.google.auto.service:auto-service:1.0-rc6'
like image 150
Oleh Kolomiets Avatar answered Oct 11 '22 02:10

Oleh Kolomiets