I m trying to deploy a Kivy Selfie camera application to android device and I got this message on the terminal in loop
#waiting for the application to start
I make sure that the device is connected and the developper mode is already activated .so how to solve this problam ???
I have made a hello world camera app with use of xcamera.
with this you can save the picture but it will be only inside the scope of the application's private dir. Which cannot be accessed unless you have root access. To save it inside phone shared memory you can follow this example Click here
main.py
from kivy.clock import Clock
from kivymd.app import MDApp
from kivy.lang import Builder
from kivy_garden.xcamera import XCamera
from android.permissions import request_permissions, Permission
#from storage import SharedStorage
try:
request_permissions([Permission.INTERNET,
Permission.READ_EXTERNAL_STORAGE,
Permission.WRITE_EXTERNAL_STORAGE,
Permission.CAMERA])
except Exception as e:
print("Like it's gonna work after this ! XD")
print(e)
KV = """
#:import XCamera kivy_garden.xcamera.XCamera
BoxLayout:
orientation: 'vertical'
BoxLayout:
id: camera_layout
canvas.before:
PushMatrix
Rotate:
angle: -90
origin: self.center
canvas.after:
PopMatrix
XCamera:
id: camera
"""
class uiApp(MDApp):
def shoot(self):
print("picture taken")
#SharedStorage().insert(path+local_filename, 'Downloads')
print("End here")
def my_callback(self, dt):
print("Taking picture...")
self.screen.ids["camera"].shoot()
print("exit my_callback !")
def build(self):
self.screen = Builder.load_string(KV)
self.screen.ids["camera"].shoot = self.shoot
self.event = Clock.schedule_once(self.my_callback, 5)
return self.screen
uiApp().run()
To see what all in installed in your local machine use pip list
buildozer.spec
[app]
# (str) Title of your application
title = Hello_testcamera
# (str) Package name
package.name = Testcam
# (str) Package domain (needed for android/ios packaging)
package.domain = org.test.cam
# (str) Source code where the main.py live
source.dir = .
# (list) Source files to include (let empty to include all the files)
source.include_exts = py,png,jpg,kv,atlas,json,xlsx,pdf,crt,pem,cer,ttf,json
# (list) List of inclusions using pattern matching
#source.include_patterns = assets/*,images/*.png
# (list) Source files to exclude (let empty to not exclude anything)
#source.exclude_exts = spec
# (list) List of directory to exclude (let empty to not exclude anything)
#source.exclude_dirs = tests, bin
# (list) List of exclusions using pattern matching
#source.exclude_patterns = license,images/*/*.jpg
# (str) Application versioning (method 1)
version = 0.35
requirements = xcamera,hostpython3==3.7.9,python3==3.7.9,kivy==2.0.0,kivymd==0.104.1,dateutil,urllib3,jmespath,jnius,cython,android,opencv-python,android,pillow,plyer,requests,chardet,idna
orientation = all
# (list) List of service to declare
#services = NAME:ENTRYPOINT_TO_PY,NAME2:ENTRYPOINT2_TO_PY
#
# OSX Specific
#
#
# author = © Copyright Info
# change the major version of python used by the app
osx.python_version = 3
# Kivy version to use
osx.kivy_version = 1.9.1
#
# Android specific
#
# (bool) Indicate if the application should be fullscreen or not
fullscreen = 1
#android.presplash_color = #FFFFFF
# (list) Permissions
android.permissions = INTERNET,WRITE_EXTERNAL_STORAGE,READ_EXTERNAL_STORAGE,CAMERA
# (int) Target Android API, should be as high as possible.
android.api = 29
# (int) Minimum API your APK will support.
#android.minapi = 27
# (int) Android SDK version to use
#android.sdk = 21
# (str) Android NDK version to use
#android.ndk = 19c
# (int) Android NDK API to use. This is the minimum API your app will support, it should usually match android.minapi.
#android.ndk_api = 21
android.accept_sdk_license = True
# (str) The Android arch to build for, choices: armeabi-v7a, arm64-v8a, x86, x86_64
android.arch = arm64-v8a
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.