Skip to content

autoclass: Class only found when called in specific places? #2242

Closed

Description

@cathay

Versions

  • Python: 3.8
  • OS: Android 9
  • Kivy: 1.11.1
  • OpenJDK: 1.8

Description

I tried to use ffprobe in my helper.py as:

def get_video_length(filename):
    ffprobe = autoclass('com.arthenica.mobileffmpeg.FFprobe')
    config = autoclass('com.arthenica.mobileffmpeg.Config')
    ....

We got the error jnius.jnius.JavaException: Class not found b'com/arthenica/mobileffmpeg/FFprobe'. The fix for it is put
ffprobe = autoclass('com.arthenica.mobileffmpeg.FFprobe') in __init__.py but it seems not straightforward to me. I would like to get some thoughts on it.

get_video_length was called on different thread from main thread

buildozer.spec

android.gradle_dependencies = com.arthenica:mobile-ffmpeg-full:4.3.2

ffmpeg repository: https://github.com/tanersener/mobile-ffmpeg

Command:

buildozer --verbose android debug deploy run

Activity

  1. changed the title [-]Autoclass works unexpectedly[/-] [+]autoclass: Class only found when called in specific places?[/+] on Jun 24, 2020
  2. RobertFlatt commented on Jun 25, 2020

    @RobertFlatt
    Contributor

    Hmm, interesting....

    All the examples show autoclass calls that are global (and probably more to the point static)
    So perhaps it matters when autoclass happens?
    The usage shown here is local, moving it to __init__.py would make it global.

    And while digging I found this, which may be also be interesting
    https://pyjnius.readthedocs.io/en/stable/api.html#pyjnius-and-threads

  3. praaggg commented on Jan 9, 2021

    @praaggg

    In my case the build itself fails while using below in spec file
    android.gradle_dependencies = com.arthenica:mobile-ffmpeg-full:4.3.2

  4. dbnicholson commented on May 31, 2022

    @dbnicholson
    Contributor

    I think the issue is most likely that you're trying to resolve the class from a new native thread. See #2533 for details.

  5. Julian-O commented on Nov 20, 2023

    @Julian-O
    Contributor

    @cathay Was this resolved by the comment above?

  6. github-actions commented on Jan 1, 2024

    @github-actions

    This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have the means to take action. Please reach out if you have or find the answers we need so that we can investigate further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions