我正在尝试使用 buildozer (python-for-android) 构建一个 android 应用程序。该应用程序使用 OpenCV 进行图像处理,在 Ubuntu 14.01 LTS 和 Windows 7 和 8.1 上运行起来就像一个魅力。
使用 buildozer 的构建过程运行良好,我可以在 Android 设备上部署应用程序,但是当我尝试在设备上启动它时应用程序崩溃。
这是我使用 adb logcat 得到的跟踪:
I/python ( 9066): Initialize Python for Android
I/python ( 9066): Android kivy bootstrap done. __name__ is __main__
I/python ( 9066): Run user program, change dir and execute main.py
I/python ( 9066): [WARNING ] [Config ] Older configuration version detected (0 instead of 13)
I/python ( 9066): [WARNING ] [Config ] Upgrading configuration in progress.
I/python ( 9066): [INFO ] [Kivy ] v1.9.0
I/python ( 9066): [INFO ] [Python ] v2.7.2 (default, Sep 23 2015, 14:05:23)
I/python ( 9066): [GCC 4.8]
I/python ( 9066): [INFO ] [Factory ] 173 symbols loaded
I/python ( 9066): [INFO ] [ImageLoaderFFPy] Using ffpyplayer 3.2-dev
I/python ( 9066): [INFO ] [Image ] Providers: img_tex, img_dds, img_gif, img_pygame, img_ffpyplayer (img_pil ignored)
I/python ( 9066): [INFO ] [VideoFFPy ] Using ffpyplayer 3.2-dev
I/python ( 9066): [INFO ] [Video ] Provider: ffpyplayer(['video_pygst', 'video_ffmpeg'] ignored)
I/python ( 9066): [INFO ] [Text ] Provider: pygame
I/python ( 9066): [INFO ] [Window ] Provider: pygame
I/libSDL ( 9066): SDL_SetVideoMode(): application requested mode 1280x800
I/python ( 9066): [INFO ] [GL ] OpenGL version <OpenGL ES 3.0 V@84.0 AU@ (CL@)>
I/python ( 9066): [INFO ] [GL ] OpenGL vendor <Qualcomm>
I/python ( 9066): [INFO ] [GL ] OpenGL renderer <Adreno (TM) 305>
I/python ( 9066): [INFO ] [GL ] OpenGL parsed version: 3, 0
I/python ( 9066): [INFO ] [GL ] Texture max size <4096>
I/python ( 9066): [INFO ] [GL ] Texture max units <16>
I/python ( 9066): [INFO ] [Shader ] program: <--From Vertex Shader:
I/python ( 9066): --From Fragment Shader:
I/python ( 9066): Link was successful.>
I/python ( 9066): [INFO ] [Support ] Android install hooks
I/python ( 9066): [INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
I/python ( 9066): ImportError: numpy.core.multiarray failed to import
I/python ( 9066): Traceback (most recent call last):
I/python ( 9066): File "/home/florian/camtest/takepicture/android/.buildozer/android/app/main.py", line 27, in <module>
I/python ( 9066): ImportError: numpy.core.multiarray failed to import
I/python ( 9066): Python for android ended.
它崩溃的python行是在导入opencv时:
import cv2
使用的 OpenCV 版本是 2.4.11(我也通过修改 python-for-android 的 recipes 文件夹中的 recipe.sh 文件尝试了 2.4.9 和 2.4.10)
使用的 Numpy 版本是 1.9.2(我也尝试了 1.7.1 和 1.9.3,但没有运气)
老实说,我不知道该怎么做,所以任何帮助将不胜感激。