I can run main.py in windown... but when buildozer to apk, it not running in android.
Please help me <3
This is main.py
from kivymd.app import MDApp
from kivy.uix.screenmanager import ScreenManager, Screen
from kivymd.uix.boxlayout import MDBoxLayout
from kivymd.toast import toast
from kivy.properties import ObjectProperty
from kivy.uix.camera import Camera
from kivy.lang import Builder
from kivy.clock import Clock
from kivy.core.window import Window
import cv2
from plyer import filechooser
class Dsmenu(MDBoxLayout):
manager = ObjectProperty()
menu = ObjectProperty()
class Chupanh(Screen):
def switch_camera(self):
try:
self.ids.camera.index = (0 if self.ids.camera.index == 1 else 1)
except AttributeError:
toast("Không tìm thấy camera")
self.ids.camera.index = (0 if self.ids.camera.index == 1 else 1)
class Phantichdv(Screen):
pass
class Anhluu(Screen):
pass
sm = ScreenManager()
sm.add_widget(Chupanh(name ='chupanh'))
sm.add_widget(Phantichdv(name ='phantichdv'))
sm.add_widget(Anhluu(name ='anhluu'))
class FingerPrintApp(MDApp):
def build(self):
self.theme_cls.primary_palette = "DeepPurple"
self.theme_cls.theme_style = "Dark"
def img_reload(self):
self.root.ids.manager.get_screen('phantichdv').ids.image_shot.reload()
def capture(self):
self.camera = self.root.ids.manager.get_screen('chupanh').ids.camera
while self.camera.export_to_png("capture_img.png"):
break
self.root.ids.manager.get_screen('chupanh').ids.camera.play = False
self.root.ids.manager.get_screen('phantichdv').ids.image_shot.source = "capture_img.png"
self.root.ids.manager.get_screen('phantichdv').ids.image_shot.reload()
def enhance_img(self):
pass
def phantich_img(self):
self.root.ids.manager.get_screen('phantichdv').ids.image_shot.source = "phantich_img.png"
def show_save_img(self):
self.root.ids.manager.get_screen('anhluu').ids.image_show.source = "phantich_img.png"
self.root.ids.manager.get_screen('anhluu').ids.image_show.reload()
def file_manager_open(self):
raw_path = filechooser.open_file(title="Chọn ảnh chứa dấu vết đường vân",
filters=[("All", "*.*"),("JPEG", "*.jpg"),("PNG", "*.png"),("TIF", "*.tif"),("Bitmap", "*.bmp")])
try:
self.img = cv2.imread(raw_path[0])
# while cv2.imwrite("capture_img.png",self.img):
while cv2.imwrite("capture_img.png",self.img):
break
self.root.ids.manager.get_screen('chupanh').ids.camera.play = False
# self.root.ids.manager.get_screen('phantichdv').ids.image_shot.source = "capture_img.png"
self.root.ids.manager.get_screen('phantichdv').ids.image_shot.source = "capture_img.png"
self.root.ids.manager.get_screen('phantichdv').ids.image_shot.reload()
except IndexError:
toast("Bạn chưa chọn file",duration=2)
FingerPrintApp().run()
and this is fingerprint.kv
MDBoxLayout:
id:screen
orientation: 'vertical'
MDToolbar:
id: toolbar
title: 'FingerPrint APP'
pos_hint: {"top": 1}
anchor_title: 'left'
elevation: 10
right_action_items: [["menu", lambda x: menu.set_state("open")]]
MDNavigationLayout:
orientation: 'vertical'
ScreenManager:
id:manager
Chupanh:
Phantichdv:
Anhluu:
MDNavigationDrawer:
id: menu
Dsmenu:
manager: manager
menu: menu
<Dsmenu>:
name: "menu"
orientation: "vertical"
# padding: "10dp"
spacing: "10dp"
BoxLayout:
orientation: "vertical"
size: "310dp", "40dp"
size_hint: None, None
# Image:
# size: "300dp", "200dp"
# pos_hint: {'center_x': 0.5 , 'top': 1}
# source:
MDLabel:
text: " Tác giả: VĂN VŨ THIÊN - PC09 Quảng Nam"
font_style: "Subtitle2"
size_hint_y: None
height: 10
MDLabel:
text: " Email: vanvuthien@gmail.com"
font_style: "Caption"
size_hint_y: None
height: 10
MDLabel:
text: " SĐT: 033.5951.464"
font_style: "Caption"
size_hint_y: None
height: 10
ScrollView:
MDList:
OneLineIconListItem:
text: "CHỌN ẢNH"
on_release:
root.menu.set_state("close")
root.manager.current = "chupanh"
root.manager.get_screen('chupanh').ids.camera.play = True
IconLeftWidget:
icon: "image-search-outline"
OneLineIconListItem:
text: "PHÂN TÍCH DẤU VẾT"
on_release:
root.menu.set_state("close")
root.manager.current = "phantichdv"
root.manager.get_screen('chupanh').ids.camera.play = False
IconLeftWidget:
icon: "fingerprint"
OneLineIconListItem:
text: "ẢNH ĐÃ PHÂN TÍCH"
on_release:
root.menu.set_state("close")
root.manager.current = "anhluu"
root.manager.get_screen('chupanh').ids.camera.play = False
IconLeftWidget:
icon: "content-save-all"
<Chupanh>:
name: 'chupanh'
Camera:
index: 0
id: camera
resolution: (600, 800)
play: True
pos_hint: {'center_x': .5, 'center_y': .5}
MDIconButton:
icon: 'image-search-outline'
md_bg_color: app.theme_cls.primary_color
user_font_size: "18sp"
elevation: 10
pos_hint: {'center_x': 0.2 , 'center_y': 0.1}
on_release:
app.file_manager_open()
root.manager.current = "phantichdv"
root.manager.transition.direction = "left"
MDFillRoundFlatIconButton:
text: 'Chụp ảnh'
icon: 'camera-iris'
elevation: 10
pos_hint: {'center_x': 0.5 , 'center_y': 0.1}
on_release:
app.capture()
root.manager.current = "phantichdv"
root.manager.transition.direction = "left"
MDIconButton:
icon: 'camera-flip-outline'
md_bg_color: app.theme_cls.primary_color
user_font_size: "18sp"
elevation: 10
pos_hint: {'center_x': 0.8 , 'center_y': 0.1}
on_release: root.switch_camera()
<Phantichdv>:
name: "phantichdv"
Image:
id: image_shot
elevation: 10
pos_hint: {'center_x': 0.5, 'center_y': 0.5}
MDLabel:
text: "Thông số:"
pos_hint: {'x': 0.05 , 'center_y': 0.95}
MDSlider:
id: slider
size_hint_x: 0.4
min: 0
max: 100
pos_hint: {'x': 0.03 , 'center_y': 0.90}
MDLabel:
text: "Âm bản:"
pos_hint: {'x': 0.45 , 'center_y': 0.95}
MDSwitch:
id: amban
pos_hint: {'x': 0.45 , 'center_y': 0.90}
active: False
MDRaisedButton:
text: 'Xử lý'
pos_hint: {'x': 0.7 , 'center_y': 0.92}
elevation: 10
on_release:
app.enhance_img()
MDIconButton:
icon: 'keyboard-backspace'
md_bg_color: app.theme_cls.primary_color
user_font_size: "18sp"
elevation: 10
pos_hint: {'center_x': 0.2 , 'center_y': 0.1}
on_release:
root.manager.current = "chupanh"
root.manager.transition.direction = "right"
root.manager.get_screen('chupanh').ids.camera.play = True
MDFillRoundFlatIconButton:
icon: 'fingerprint'
text: 'Phân tích'
pos_hint: {'center_x': 0.5 , 'center_y': 0.1}
on_release: app.phantich_img()
MDIconButton:
icon: 'content-save-all-outline'
md_bg_color: app.theme_cls.primary_color
theme_text_color: "Custom"
user_font_size: "18sp"
elevation: 10
text_color: 1,1,1,1
pos_hint: {'center_x': 0.8 , 'center_y': 0.1}
on_release:
app.show_save_img()
root.manager.current = "anhluu"
root.manager.transition.direction = "left"
MDProgressBar:
id: prog
type: 'indeterminate'
pos_hint: {'center_x': 0.5 , 'center_y': 0.02}
<Anhluu>:
name: "anhluu"
Image:
id: image_show
pos_hint: {'top': 1}
MDIconButton:
icon: 'camera-iris'
md_bg_color: app.theme_cls.primary_color
user_font_size: "18sp"
elevation: 10
pos_hint: {'center_x': 0.75 , 'center_y': 0.1}
on_release:
root.manager.get_screen('chupanh').ids.camera.play = True
root.manager.current = "chupanh"
root.manager.transition.direction = "right"
MDIconButton:
icon: 'keyboard-backspace'
md_bg_color: app.theme_cls.primary_color
user_font_size: "18sp"
elevation: 10
pos_hint: {'center_x': 0.25 , 'center_y': 0.1}
on_release:
root.manager.current = "phantichdv"
root.manager.transition.direction = "right"
I made buildozer.spec with
requirements = python3,opencv-python,plyer,kivy==2.0.0,https://github.com/kivymd/KivyMD/archive/master.zip
and
android.permissions = CAMERA, WRITE_EXTERNAL_STORAGE, READ_EXTERNAL_STORAGE
logcat:
09-24 15:13:58.661 1330 1365 I python : Traceback (most recent call last):
09-24 15:13:58.661 1330 1365 I python : File "/content/.buildozer/android/app/main.py", line 10, in <module>
09-24 15:13:58.661 1330 1365 I python : File "/content/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/easy/cv2/__init__.py", line 5, in <module>
09-24 15:13:58.661 1330 1365 I python : ImportError: dlopen failed: "/data/data/org.test.easy/files/app/_python_bundle/site-packages/cv2/cv2.so" is 64-bit instead of 32-bit
09-24 15:13:58.661 1330 1365 I python : Python for android ended.
09-24 15:13:58.878 2089 3881 I ActivityManager: Process org.test.easy (pid 1330) has died: fore TOP
09-24 15:13:58.910 2089 2191 W ActivityManager: setHasOverlayUi called on unknown pid: 1330