5

I am building a Kivy app that requires the OpenCV module, but the Kivy Launcher keeps crashing when I run it.

I have downloaded OpenCV from PyPi (https://pypi.python.org/pypi/opencv-python#downloads) and placed it into my kivy project directory. My project directory currently contains the main.py file, the android.txt file, and the opencv download. In the main.py file I write "import cv2" at the top of the code. However, my app keeps crashing in the Kivy launcher.

What is the correct way to install python extensions for use in Kivy Launcher?

BTW- I am brand new to Kivy and Android app development, so any help is much appreciated

Sachit Gali
  • 129
  • 1
  • 2
  • 10

1 Answers1

4

I have downloaded OpenCV from PyPi (https://pypi.python.org/pypi/opencv-python#downloads) and placed it into my kivy project directory

This is not how things work. OpenCV should be compiled specifically for Android. I guess you use buildozer to build apk? In this case you should modify requirements line inside buildozer.spec file to add opencv, for example:

requirements =  kivy, opencv

Compiling python modules for Android provided by python-for-android project.

Mikhail Gerasimov
  • 36,989
  • 16
  • 116
  • 159
  • I am not building an apk nor do I plan to- right now I am only trying to test my kivy project with the Kivy Launcher app. How can I compile opencv for use in Kivy Launcher? – Sachit Gali Dec 26 '17 at 19:34
  • 1
    @SachitGali you can't do it. Launcher provided with minimal amount of modules compiled for Android. You need to build apk if you want to use modules. – Mikhail Gerasimov Dec 26 '17 at 19:57