question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

1.3.0 breaks android's request_permission

See original GitHub issue

reported by an user (Matrix0206 on discord).

from android import request_permission, Permission

request_permissions([Permission.READ_EXTERNAL_STORAGE, Permission.WRITE_EXTERNAL_STORAGE])
05-22 20:08:20.301 10976 11090 I python  :  Traceback (most recent call last):
05-22 20:08:20.301 10976 11090 I python  :    File "/run/media/matrix/New_Volume/Developments/kivy-music-player/.buildozer/android/app/main.py", line 300, in <module>
05-22 20:08:20.301 10976 11090 I python  :    File "/run/media/matrix/New_Volume/Developments/kivy-music-player/.buildozer/android/platform/build-arm64-v8a/build/python-installs/music_player/kivy/app.py", line 949, in run
05-22 20:08:20.302 10976 11090 I python  :    File "/run/media/matrix/New_Volume/Developments/kivy-music-player/.buildozer/android/platform/build-arm64-v8a/build/python-installs/music_player/kivy/app.py", line 919, in _run_prepare
05-22 20:08:20.302 10976 11090 I python  :    File "/run/media/matrix/New_Volume/Developments/kivy-music-player/.buildozer/android/app/main.py", line 132, in build
05-22 20:08:20.302 10976 11090 I python  :    File "/run/media/matrix/New_Volume/Developments/kivy-music-player/.buildozer/android/platform/build-arm64-v8a/build/python-installs/music_player/kivy/uix/relativelayout.py", line 274, in __init__
05-22 20:08:20.303 10976 11090 I python  :    File "/run/media/matrix/New_Volume/Developments/kivy-music-player/.buildozer/android/platform/build-arm64-v8a/build/python-installs/music_player/kivy/uix/floatlayout.py", line 65, in __init__
05-22 20:08:20.303 10976 11090 I python  :    File "/run/media/matrix/New_Volume/Developments/kivy-music-player/.buildozer/android/platform/build-arm64-v8a/build/python-installs/music_player/kivy/uix/layout.py", line 76, in __init__
05-22 20:08:20.303 10976 11090 I python  :    File "/run/media/matrix/New_Volume/Developments/kivy-music-player/.buildozer/android/platform/build-arm64-v8a/build/python-installs/music_player/kivy/uix/widget.py", line 359, in __init__
05-22 20:08:20.304 10976 11090 I python  :    File "/run/media/matrix/New_Volume/Developments/kivy-music-player/.buildozer/android/platform/build-arm64-v8a/build/python-installs/music_player/kivy/uix/widget.py", line 463, in apply_class_lang_rules
05-22 20:08:20.304 10976 11090 I python  :    File "/run/media/matrix/New_Volume/Developments/kivy-music-player/.buildozer/android/platform/build-arm64-v8a/build/python-installs/music_player/kivy/lang/builder.py", line 539, in apply
05-22 20:08:20.304 10976 11090 I python  :    File "/run/media/matrix/New_Volume/Developments/kivy-music-player/.buildozer/android/platform/build-arm64-v8a/build/python-installs/music_player/kivy/lang/builder.py", line 661, in _apply_rule
05-22 20:08:20.304 10976 11090 I python  :    File "/run/media/matrix/New_Volume/Developments/kivy-music-player/.buildozer/android/platform/build-arm64-v8a/build/python-installs/music_player/kivy/lang/builder.py", line 661, in _apply_rule
05-22 20:08:20.305 10976 11090 I python  :    File "/run/media/matrix/New_Volume/Developments/kivy-music-player/.buildozer/android/platform/build-arm64-v8a/build/python-installs/music_player/kivy/lang/builder.py", line 657, in _apply_rule
05-22 20:08:20.305 10976 11090 I python  :    File "/run/media/matrix/New_Volume/Developments/kivy-music-player/.buildozer/android/app/screens/main_screen/home.py", line 36, in __init__
05-22 20:08:20.305 10976 11090 I python  :    File "/run/media/matrix/New_Volume/Developments/kivy-music-player/.buildozer/android/platform/build-arm64-v8a/build/python-installs/music_player/android/permissions.py", line 570, in request_permissions
05-22 20:08:20.305 10976 11090 I python  :    File "/run/media/matrix/New_Volume/Developments/kivy-music-player/.buildozer/android/platform/build-arm64-v8a/build/python-installs/music_player/android/permissions.py", line 513, in request_permissions
05-22 20:08:20.306 10976 11090 I python  :    File "jnius/jnius_export_class.pxi", line 1134, in jnius.jnius.JavaMultipleMethod.__call__
05-22 20:08:20.306 10976 11090 I python  :  jnius.jnius.JavaException: No methods matching your arguments, requested: (['android.permission.READ_EXTERNAL_STORAGE', 'android.permission.WRITE_EXTERNAL_STORAGE'],), available: []

while this worked in 1.2.1.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:23 (20 by maintainers)

github_iconTop GitHub Comments

1reaction
obfuskcommented, Oct 22, 2020

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. And now we understand the cause of the problem. So I don’t think we need a new issue.

1reaction
obfuskcommented, Oct 22, 2020

the patch has been merged

Not yet; but it has been approved 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

callback of registerForActivityResult(RequestPermission ...
I added implementation 'androidx.fragment:fragment-ktx:1.3.0-alpha07'. Callback runs. Exceptions gone.
Read more >
Fragment - Android Developers
This release fixes a number of issues around invalid request codes and the dispatch of permission requests that prevent the Activity Result API...
Read more >
UI testing of Android Runtime Permissions
Let's explore different ways of granting and revoking permission in UI test cases. Interaction with Runtime permissions. We have different ways ...
Read more >
Ian Lake on Twitter: "Fragment 1.3.0 includes the new state ...
Jetpack's release today is headlined by stable releases of Fragment 1.3.0, ... easier testing to the startActivityForResult and requestPermissions flows.
Read more >
A first look at AndroidX Activity Result APIs - Medium
... since AndroidX Activity 1.2.0-alpha02 and Fragment 1.3.0-alpha02. ... RequestPermissions : for requesting multiple Runtime Permissions, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found