Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
cathay opened this issue Jun 24, 2020 · 5 comments
Closed

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

cathay opened this issue Jun 24, 2020 · 5 comments

Comments

@cathay
Copy link

cathay commented Jun 24, 2020

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
@cathay cathay changed the title Autoclass works unexpectedly autoclass: Class only found when called in specific places? Jun 24, 2020
@RobertFlatt
Copy link
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

@praaggg
Copy link

praaggg commented Jan 9, 2021

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

@dbnicholson
Copy link
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.

@Julian-O
Copy link
Contributor

@cathay Was this resolved by the comment above?

Copy link

github-actions bot commented Jan 1, 2024

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.

@github-actions github-actions bot closed this as completed Jan 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants