PyJnius can't find the org.jnius.NativeInvocationHandler class when started in service.
I have an `OnCompleteListener` class that works fine when it's instantiated in the Activity. But when I instantiate it in my service, Jnius for some reason can't find its invocation handler class mentioned above.
Here's my class and the traceback:
Code:
class OnCompleteListener(PythonJavaClass):
__javainterfaces__ = ["android/media/MediaPlayer$OnCompletionListener"]
__javacontext__ = "app"
def __init__(self, audio_player, **kwargs):
super().__init__(**kwargs)
self.called = False
self.audio_player = audio_player
@java_method("(Landroid/media/MediaPlayer;)V")
def onCompletion(self, mp):
Logger.info('AUDIO: Playback completed.')
self.audio_player.is_complete = True
self.audio_player.state = 'stop'
self.audio_player.unload()
self.audio_player.on_complete_callback()
self.audio_player = None
Traceback:
geniustmusicplayer/geniustmusicplayer/android_audio_player.py", line 25, in __init__ # --> line 25 is super().__init__(**kwargs) line
File "jnius/jnius_proxy.pxi", line 28, in jnius.jnius.PythonJavaClass.__init__
File "jnius/jnius_proxy.pxi", line 34, in jnius.jnius.PythonJavaClass._init_j_self_ptr
File "jnius/jnius_proxy.pxi", line 165, in jnius.jnius.create_proxy_instance
File "/home/hazhir/.local/share/python-for-android/build/python-installs/geniustmusicplayer/jnius/reflect.py", line 229, in autoclass
File "jnius/jnius_export_func.pxi", line 26, in jnius.jnius.find_javaclass
File "jnius/jnius_utils.pxi", line 91, in jnius.jnius.check_exception
jnius.jnius.JavaException: JVM exception occurred: Didn't find class "org.jnius.NativeInvocationHandler" on path: DexPathList[[directory "."],nativeLibraryDirectories=[/system/lib, /vendor/lib, /data/downloads, /data/priv-downloads, /system/lib, /vendor/lib, /data/downloads, /data/priv-downloads]] java.lang.ClassNotFoundException