community
community copied to clipboard
Kivy not support all cameras on android
Software Versions
- Python: 3
- OS: android
- Kivy: 1.10.1
- Build with buildozer
Describe the bug
Kivy can only access to 2 camera on android (\dev\video0, \dev\video1) but device has multiple cameras (result from ls /dev/ | grep "video*") ["b'video0\\nvideo1\\nvideo2\\nvideo32\\nvideo33\\nvideo34\\n'"]
.
I notice this error ServiceManager: Permission failure: android.permission.SYSTEM_CAMERA from uid=10269 pid=27228
when I want to access the camera with index 2.
I can only use camera video0 and video1.
I have permission for a camera in bulldozer spec android.permissions = CAMERA
.
I define a button that changes the camera's index to see if I can use multiple cameras in one run of the app, and it worked with 0, 1.
I want to use this app with an external camera, which is impossible in this situation. Please help.
Error:
08-01 18:47:39.705 1370 4278 I Camera2ClientBase: Closed Camera 1. Client was: org.mathor.objectdetection_yolo (PID 27228, UID 10269)
08-01 18:47:39.705 1370 4278 I Camera3-Device: disconnectImpl: E
08-01 18:47:39.706 1370 2972 W ServiceManager: Permission failure: android.permission.SYSTEM_CAMERA from uid=10269 pid=27228
08-01 18:47:39.707 27228 27292 I python : [INFO ] [Base ] Leaving application in progress...
08-01 18:47:39.707 27228 27292 I python : Traceback (most recent call last):
08-01 18:47:39.707 27228 27292 I python : File "/Users/matho/MyRepo/Repository/KivyApps/object_detection/.buildozer/android/app/main.py", line 25, in <module>
08-01 18:47:39.708 27228 27292 I python : File "/Users/matho/MyRepo/Repository/KivyApps/object_detection/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/objectdetection_yolo/armeabi-v7a/kivy/app.py", line 955, in run
08-01 18:47:39.708 27228 27292 I python : File "/Users/matho/MyRepo/Repository/KivyApps/object_detection/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/objectdetection_yolo/armeabi-v7a/kivy/base.py", line 574, in runTouchApp
08-01 18:47:39.708 27228 27292 I python : File "/Users/matho/MyRepo/Repository/KivyApps/object_detection/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/objectdetection_yolo/armeabi-v7a/kivy/base.py", line 339, in mainloop
08-01 18:47:39.709 27228 27292 I python : File "/Users/matho/MyRepo/Repository/KivyApps/object_detection/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/objectdetection_yolo/armeabi-v7a/kivy/base.py", line 383, in idle
08-01 18:47:39.709 27228 27292 I python : File "/Users/matho/MyRepo/Repository/KivyApps/object_detection/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/objectdetection_yolo/armeabi-v7a/kivy/base.py", line 334, in dispatch_input
08-01 18:47:39.709 27228 27292 I python : File "/Users/matho/MyRepo/Repository/KivyApps/object_detection/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/objectdetection_yolo/armeabi-v7a/kivy/base.py", line 263, in post_dispatch_input
08-01 18:47:39.709 27228 27292 I python : File "kivy/_event.pyx", line 731, in kivy._event.EventDispatcher.dispatch
08-01 18:47:39.709 27228 27292 I python : File "/Users/matho/MyRepo/Repository/KivyApps/object_detection/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/objectdetection_yolo/armeabi-v7a/kivy/core/window/__init__.py", line 1660, in on_motion
08-01 18:47:39.709 27228 27292 I python : File "kivy/_event.pyx", line 731, in kivy._event.EventDispatcher.dispatch
08-01 18:47:39.709 27228 27292 I python : File "/Users/matho/MyRepo/Repository/KivyApps/object_detection/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/objectdetection_yolo/armeabi-v7a/kivy/core/window/__init__.py", line 1677, in on_touch_down
08-01 18:47:39.709 27228 27292 I python : File "kivy/_event.pyx", line 731, in kivy._event.EventDispatcher.dispatch
08-01 18:47:39.709 27228 27292 I python : File "/Users/matho/MyRepo/Repository/KivyApps/object_detection/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/objectdetection_yolo/armeabi-v7a/kivy/uix/widget.py", line 589, in on_touch_down
08-01 18:47:39.710 27228 27292 I python : File "kivy/_event.pyx", line 731, in kivy._event.EventDispatcher.dispatch
08-01 18:47:39.710 27228 27292 I python : File "/Users/matho/MyRepo/Repository/KivyApps/object_detection/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/objectdetection_yolo/armeabi-v7a/kivy/uix/widget.py", line 589, in on_touch_down
08-01 18:47:39.710 27228 27292 I python : File "kivy/_event.pyx", line 731, in kivy._event.EventDispatcher.dispatch
08-01 18:47:39.710 27228 27292 I python : File "/Users/matho/MyRepo/Repository/KivyApps/object_detection/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/objectdetection_yolo/armeabi-v7a/kivy/uix/behaviors/button.py", line 151, in on_touch_down
08-01 18:47:39.711 27228 27292 I python : File "kivy/_event.pyx", line 727, in kivy._event.EventDispatcher.dispatch
08-01 18:47:39.711 27228 27292 I python : File "kivy/_event.pyx", line 1307, in kivy._event.EventObservers.dispatch
08-01 18:47:39.711 27228 27292 I python : File "kivy/_event.pyx", line 1231, in kivy._event.EventObservers._dispatch
08-01 18:47:39.711 27228 27292 I python : File "/Users/matho/MyRepo/Repository/KivyApps/object_detection/.buildozer/android/app/custom_camera/custom_camera.py", line 35, in change_index
08-01 18:47:39.711 27228 27292 I python : File "/Users/matho/MyRepo/Repository/KivyApps/object_detection/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/objectdetection_yolo/armeabi-v7a/kivy/core/camera/__init__.py", line 90, in _set_index
08-01 18:47:39.711 27228 27292 I python : File "/Users/matho/MyRepo/Repository/KivyApps/object_detection/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/objectdetection_yolo/armeabi-v7a/kivy/core/camera/camera_android.py", line 49, in init_camera
08-01 18:47:39.711 27228 27292 I python : File "jnius/jnius_export_class.pxi", line 1177, in jnius.jnius.JavaMultipleMethod.__call__
08-01 18:47:39.712 27228 27292 I python : File "jnius/jnius_export_class.pxi", line 884, in jnius.jnius.JavaMethod.__call__
08-01 18:47:39.712 27228 27292 I python : File "jnius/jnius_export_class.pxi", line 1056, in jnius.jnius.JavaMethod.call_staticmethod
08-01 18:47:39.712 27228 27292 I python : File "jnius/jnius_utils.pxi", line 91, in jnius.jnius.check_exception
08-01 18:47:39.712 27228 27292 I python : jnius.jnius.JavaException: JVM exception occurred: Unknown camera ID java.lang.RuntimeException
08-01 18:47:39.712 27228 27292 I python : Python for android ended.
I think this is an Android constraint. The latest Android Java API (CameraX) only supports Front (1) and Back (0) cameras. It does not support USB cameras.
I don't know what Video2 is, I'd guess it is a component of Back. The current api does not make it visible.
Kivy Camera uses an older api, which has the same constraint.
👋 We use the issue tracker exclusively for bug reports and feature requests. However, this issue appears to be a support request. Please use our support channels to get help with the project.
If you're having trouble installing Kivy, make sure to check out the installation docs for Windows, Linux and macOS.
Let us know if this comment was made in error, and we'll be happy to reopen the issue.