I'm having issues getting Kivy FileChooserListView to work.
My Python script:
# check if on android and request permissions from sys import platform if platform == 'android': from android.permissions import request_permissions, Permission from android.storage import app_storage_path, primary_external_storage_path request_permissions([ Permission.READ_EXTERNAL_STORAGE, Permission.WRITE_EXTERNAL_STORAGE ]) class MyLayout(Widget): pass class k8(App): def build(self): return MyLayout() if __name__ == '__main__': k8().run()
Buildozer.spec:
... # (list) Application requirements # comma separated e.g. requirements = sqlite3,kivy requirements = python3,kivy,pillow,numpy,pandas,matplotlib,pyjnius ... # (list) Permissions # (See https://python-for-android.readthedocs.io/en/latest/buildoptions.html for all the supported syntaxes and properties) #android.permissions = android.permission.INTERNET, (name=android.permission.WRITE_EXTERNAL_STORAGE;maxSdkVersion=18), MANAGE_EXTERNAL_STORAGE android.permissions = MANAGE_EXTERNAL_STORAGE
When I run the app in android I get a black screen with two texts at the top, "name" and "size".
The error report I get in logcat:
adb logcat | grep python ... 23690 23732 I python : PermissionError: [Errno 13] Permission denied: '/'
I think the issue is that my app doesn't have permission to access the files, I'm not sure what I can do to get access.
Android has strong restrictions on file access permissions. You might need to provide your FileChooserListView with a start folder that you can access. For example:
from android.storage import primary_external_storage_path
primary = primary_external_storage_path()
FileChooserListView(path=primary)
You might also need the MANAGE_EXTERNAL_STORAGE permission in your request_permissions() code.
John Anderson