-
Notifications
You must be signed in to change notification settings - Fork 255
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
1.3.0 breaks android's request_permission #538
Comments
hi guys I have the same problem, how to solve it? it's possible to use an older pyjnius in buildozer build? thanks! |
Pinning the version using |
I'm not a Kivy person, but can someone paste a link to the relevant source code? |
thanks, infact it worked! |
While pegging the Pyjnius version to 1.2.1 may work for this, v1.2.1 has other limitations, so ideally this should be addressed going forward.... |
that would be there https://github.com/kivy/python-for-android/blob/develop/pythonforandroid/recipes/android/src/android/permissions.py#L513 sorry i didn't take the time to investigate this at all. |
Its made difficult as we cant easily see what the Activity class name is |
i would expect it to be https://github.com/kivy/python-for-android/blob/develop/pythonforandroid/bootstraps/sdl2/build/src/main/java/org/kivy/android/PythonActivity.java#L42 but it can be the equivalent class in another bootstrap (https://github.com/kivy/python-for-android/tree/develop/pythonforandroid/bootstraps) |
It looks like |
So it looks like it's a bug in p4a's |
Good spot. Indeed; as in Java, calling a non-static method on a static object would not be allowed by the compiler. @obfusk can you update kivy/python-for-android#2304? I do think the Pyjnius error could be clearer also - ie the name of the method was not found and in what object! |
I'm rather surprised this used to work. |
Could this be related to these pyjnius/jnius/jnius_export_class.pxi Lines 815 to 822 in 3371e10
pyjnius/jnius/jnius_export_class.pxi Lines 1079 to 1087 in 3371e10
|
👍 |
PR sent - see #558. |
So the summary for anyone reading this in the future:
|
Not yet; but it has been approved :) |
I think those |
Can you show a simpler test case, and then we make a new issue? |
With 1.2.1: >>> from jnius import autoclass
>>> s = autoclass("java.lang.String")
>>> s.toString()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "jnius/jnius_export_class.pxi", line 755, in jnius.JavaMethod.__call__
File "jnius/jnius_export_class.pxi", line 699, in jnius.JavaMethod.ensure_method
jnius.JavaException: Unable to find a None method!
classname: None, definition: ()Ljava/lang/String;
>>> s("foo").toString()
'foo'
>>> s.toString()
'foo' With 1.3.0: >>> from jnius import autoclass
>>> s = autoclass("java.lang.String")
>>> s("foo").toString()
'foo'
>>> s.toString()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "jnius/jnius_export_class.pxi", line 1134, in jnius.JavaMultipleMethod.__call__
jnius.JavaException: No methods matching your arguments, requested: (), available: [] Since calling a non-static method on a class no longer works, the problem's already been fixed. |
Or: as no-one seems aware of how this was fixed in 1.3.0, we add a testcase to prevent a future regression back to the previous behaviour. The testcase can expect the exception in the case above. And can we remove the FIXME's then? |
I've actually figured it out now. And the problem was only partially fixed 😅. See #567
Not yet I think. See #563. |
Just a note, I changed my p4a branch to 'develop' and still had this issue. I wiped my .buildozer folder and rebuilt, and the 'develop' branch won't build fresh for me without linking errors (2020-12-13, 16:22 -0500) (EDIT: sorry, this was a different issue. I can't seem to run buildozer successfully on my system, at all, for now.) I think the way to go for working around this in client apps is to manually make the pyjnius call, so the client codebase will work equally well on the different versions. Obviously releases that fix this are sorely needed here. |
reported by an user (Matrix0206 on discord).
while this worked in 1.2.1.
The text was updated successfully, but these errors were encountered: