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

b"Exception in connect function: Class not found b'org/jnius/NativeInvocationHandler'" when trying to use camera module #527

Open
tomgold182 opened this issue Dec 6, 2019 · 13 comments

Comments

@tomgold182
Copy link

after applying @franccisco's #520 fix, i am getting this error when trying to access the camera with camera.take_picture:
b"Exception in connect function: Class not found b'org/jnius/NativeInvocationHandler'"

@ghost
Copy link

ghost commented Dec 6, 2019

Thanks for testing the PR and posting your results. To figure out what's going on, I need some info:

  1. What's your kivy and pyjnius version?
  2. Please, paste a more detailed log. I'd like to know what else is crashing.

@tomgold182
Copy link
Author

I am using kivy 1.8.0
following some blog post on this issue,
i added this line
autoclass('org.jnius.NativeInvocationHandler')
on my main thread and it seems to be solving this issue ,
but then leads to this:

Exception in connect function: Class not found b'org/kivy/android/PythonActivity$ActivityResultListener'

there no more information in the logs, just the line i sent you. is there a way to get a more detailed log?

@tomgold182
Copy link
Author

pyjnius seems to be 1.2.0

@tshirtman
Copy link
Member

tshirtman commented Dec 7, 2019

python for android currently pins pyjnius to commit 6553ad4 which is the next commit after 1.2.0, it hasn't been tried with the newer 1.2.1 release of pyjnius yet.
https://github.com/kivy/python-for-android/blob/2610330cfca7f43d2fa69e175f4b9c3d09338680/pythonforandroid/recipes/pyjnius/__init__.py#L11

@tomgold182
Copy link
Author

@tshirtman I tried the official version also. Same issue, that's why i have tried to change.

@tshirtman
Copy link
Member

I'm looking into building/using latest pyjnius with android, at the moment it's not possible. I'm not sure this would solve this particular issue, but it would maybe help finding the cause and fixing it.

@tshirtman
Copy link
Member

tshirtman commented Dec 7, 2019

I couldn't get the NativeInvocationHandler issue reproduced, but i couldn't get a picture either, i think the plyer's code is obsolete, so i looked into ways to get it up to current apis, but couldn't get the result picture from java to kivy, https://gist.github.com/4bf8fdf745eb4a961b0f83066fe6a8d3 if anyone wants to have a look, sorry, this is not exactly beautiful code, as i tried different things and kept things that were nearly working commented just in case.

This is using latest pyjnius, with a slight update to the recipe to get it to build, but i don't think it's related. kivy/python-for-android#2036 i created a pull request, you can use these files as a local recipe if you want to try with latest pyjnius.

@tomgold182
Copy link
Author

@tshirtman Thanks!
So you are suggesting using pyjnius directly instead of plyer?

@tshirtman
Copy link
Member

Once a working and reliable method is found, it can be generalized again and put inside plyer, for now, it's just easier to experiment with pyjnius direclty to find that method.

@Fak3
Copy link

Fak3 commented Feb 3, 2020

For the camera to work, one has to add an android fileprovider to solve #500. The PR for that is kivy/python-for-android#1922 but unfortunately I could not find time to document its usage yet.

@tomgold182
Copy link
Author

@Fak3 any updates about that ? how can I manually apply your fix?

@Fak3
Copy link

Fak3 commented Apr 10, 2020

@Fak3 any updates about that ? how can I manually apply your fix?

You can checkout git branch from that pr somwhere, then launch setup.py install in that dir to install p4a. Then you can create your fileprovider xml file in your app dir, and build your app as described in the pr

@tomgold182
Copy link
Author

@Fak3 is that already in main ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants