Kivy在Android发布时崩溃了

时间:2014-05-02 13:40:07

标签: android python kivy ws4py

当我在我的Android手机(三星GSIII)上启动我的Kivy应用程序时,会出现闪屏,然后它会崩溃并返回到我之前的屏幕。在跟踪和错误之后,我确定了导入ws4py导致错误的事实。

我在要求requirements = kivy,ws4py下的buildozer.spec文件中添加了ws4py,并且在运行$>buildozer android debug时似乎正确下载了。查看ws4py的源代码并阅读文档,除了标准库中的模块之外没有其他导入,因此它似乎不是依赖问题(但可能是?)。

DDMS日志在这里:

05-02 09:17:29.677: D/dalvikvm(22120): Trying to load lib /data/app-lib/com.shufudesign.drmb-2/libsdl.so 0x422833c8
05-02 09:17:29.687: D/dalvikvm(22120): Added shared lib /data/app-lib/com.shufudesign.drmb-2/libsdl.so 0x422833c8
05-02 09:17:29.687: D/dalvikvm(22120): Trying to load lib /data/app-lib/com.shufudesign.drmb-2/libsdl_image.so 0x422833c8
05-02 09:17:29.697: D/dalvikvm(22120): Added shared lib /data/app-lib/com.shufudesign.drmb-2/libsdl_image.so 0x422833c8
05-02 09:17:29.697: D/dalvikvm(22120): No JNI_OnLoad found in /data/app-lib/com.shufudesign.drmb-2/libsdl_image.so 0x422833c8, skipping init
05-02 09:17:29.697: D/dalvikvm(22120): Trying to load lib /data/app-lib/com.shufudesign.drmb-2/libsdl_ttf.so 0x422833c8
05-02 09:17:29.697: D/dalvikvm(22120): Added shared lib /data/app-lib/com.shufudesign.drmb-2/libsdl_ttf.so 0x422833c8
05-02 09:17:29.697: D/dalvikvm(22120): No JNI_OnLoad found in /data/app-lib/com.shufudesign.drmb-2/libsdl_ttf.so 0x422833c8, skipping init
05-02 09:17:29.697: D/dalvikvm(22120): Trying to load lib /data/app-lib/com.shufudesign.drmb-2/libsdl_mixer.so 0x422833c8
05-02 09:17:29.707: D/dalvikvm(22120): Added shared lib /data/app-lib/com.shufudesign.drmb-2/libsdl_mixer.so 0x422833c8
05-02 09:17:29.707: D/dalvikvm(22120): No JNI_OnLoad found in /data/app-lib/com.shufudesign.drmb-2/libsdl_mixer.so 0x422833c8, skipping init
05-02 09:17:29.707: D/dalvikvm(22120): Trying to load lib /data/app-lib/com.shufudesign.drmb-2/libpython2.7.so 0x422833c8
05-02 09:17:29.727: D/dalvikvm(22120): Added shared lib /data/app-lib/com.shufudesign.drmb-2/libpython2.7.so 0x422833c8
05-02 09:17:29.727: D/dalvikvm(22120): No JNI_OnLoad found in /data/app-lib/com.shufudesign.drmb-2/libpython2.7.so 0x422833c8, skipping init
05-02 09:17:29.727: D/dalvikvm(22120): Trying to load lib /data/app-lib/com.shufudesign.drmb-2/libapplication.so 0x422833c8
05-02 09:17:29.727: D/dalvikvm(22120): Added shared lib /data/app-lib/com.shufudesign.drmb-2/libapplication.so 0x422833c8
05-02 09:17:29.727: D/dalvikvm(22120): No JNI_OnLoad found in /data/app-lib/com.shufudesign.drmb-2/libapplication.so 0x422833c8, skipping init
05-02 09:17:29.727: D/dalvikvm(22120): Trying to load lib /data/app-lib/com.shufudesign.drmb-2/libsdl_main.so 0x422833c8
05-02 09:17:29.727: D/dalvikvm(22120): Added shared lib /data/app-lib/com.shufudesign.drmb-2/libsdl_main.so 0x422833c8
05-02 09:17:29.737: D/dalvikvm(22120): No JNI_OnLoad found in /data/app-lib/com.shufudesign.drmb-2/libsdl_main.so 0x422833c8, skipping init
05-02 09:17:29.737: D/dalvikvm(22120): Trying to load lib /data/data/com.shufudesign.drmb/files/lib/python2.7/lib-dynload/_io.so 0x422833c8
05-02 09:17:29.737: D/dalvikvm(22120): Added shared lib /data/data/com.shufudesign.drmb/files/lib/python2.7/lib-dynload/_io.so 0x422833c8
05-02 09:17:29.737: D/dalvikvm(22120): No JNI_OnLoad found in /data/data/com.shufudesign.drmb/files/lib/python2.7/lib-dynload/_io.so 0x422833c8, skipping init
05-02 09:17:29.737: D/dalvikvm(22120): Trying to load lib /data/data/com.shufudesign.drmb/files/lib/python2.7/lib-dynload/unicodedata.so 0x422833c8
05-02 09:17:29.747: D/dalvikvm(22120): Added shared lib /data/data/com.shufudesign.drmb/files/lib/python2.7/lib-dynload/unicodedata.so 0x422833c8
05-02 09:17:29.747: D/dalvikvm(22120): No JNI_OnLoad found in /data/data/com.shufudesign.drmb/files/lib/python2.7/lib-dynload/unicodedata.so 0x422833c8, skipping init
05-02 09:17:29.747: D/dalvikvm(22120): Trying to load lib /data/app-lib/com.shufudesign.drmb-2/libsqlite3.so 0x422833c8
05-02 09:17:29.757: D/dalvikvm(22120): Added shared lib /data/app-lib/com.shufudesign.drmb-2/libsqlite3.so 0x422833c8
05-02 09:17:29.757: D/dalvikvm(22120): No JNI_OnLoad found in /data/app-lib/com.shufudesign.drmb-2/libsqlite3.so 0x422833c8, skipping init
05-02 09:17:29.757: D/dalvikvm(22120): Trying to load lib /data/data/com.shufudesign.drmb/files/lib/python2.7/lib-dynload/_sqlite3.so 0x422833c8
05-02 09:17:29.757: D/dalvikvm(22120): Added shared lib /data/data/com.shufudesign.drmb/files/lib/python2.7/lib-dynload/_sqlite3.so 0x422833c8
05-02 09:17:29.757: D/dalvikvm(22120): No JNI_OnLoad found in /data/data/com.shufudesign.drmb/files/lib/python2.7/lib-dynload/_sqlite3.so 0x422833c8, skipping init
05-02 09:17:29.767: D/dalvikvm(22120): Trying to load lib /data/data/com.shufudesign.drmb/files/lib/python2.7/lib-dynload/_imaging.so 0x422833c8
05-02 09:17:29.767: E/dalvikvm(22120): dlopen("/data/data/com.shufudesign.drmb/files/lib/python2.7/lib-dynload/_imaging.so") failed: dlopen failed: library "/data/data/com.shufudesign.drmb/files/lib/python2.7/lib-dynload/_imaging.so" not found
05-02 09:17:30.488: I/python(22120): ['/data/data/com.shufudesign.drmb/files/lib/python2.7/site-packages', '/data/data/com.shufudesign.drmb/files/lib/site-python']
05-02 09:17:30.488: I/python(22120): Android path ['/data/data/com.shufudesign.drmb/files/lib/python27.zip', '/data/data/com.shufudesign.drmb/files/lib/python2.7', '/data/data/com.shufudesign.drmb/files/lib/python2.7/lib-dynload', '/data/data/com.shufudesign.drmb/files/lib/python2.7/site-packages', '/data/data/com.shufudesign.drmb/files', '/data/data/com.shufudesign.drmb/files/lib/python2.7/site-packages/PIL', '/data/data/com.shufudesign.drmb/files/_applibs']
05-02 09:17:30.908: I/python(22120): [INFO              ] [Logger      ] Record log in /data/data/com.shufudesign.drmb/files/.kivy/logs/kivy_14-05-02_0.txt
05-02 09:17:31.990: I/python(22120):  /data/data/com.shufudesign.drmb/files/lib/python2.7/site-packages/kivy/core/image/img_pygame.py:12: RuntimeWarning: import cdrom: No module named cdrom
05-02 09:17:32.250: I/ActivityManager(610): Process com.shufudesign.drmb:python (pid 22120) (adj 0) has died.
05-02 09:17:32.250: W/ActivityManager(610): Force removing ActivityRecord{42ed13d0 u0 com.shufudesign.drmb/org.renpy.android.PythonActivity}: app died, no saved state

我查了几个关于kivy和python-for-android谷歌群体的问题,他们对_imaging.so错误有同样的疑问。这种反应似乎并没有引起这个问题。我删除了我的应用程序中的所有内容,除了画一个圆圈(有效),然后添加ws4py导入(打破了所有内容)。

除了将第三方库添加到spec文件中之外,是否还有其他关于添加第三方库的内容?在Ubuntu中运行时一切正常。任何帮助都将非常感激,因为我的应用程序依赖于Web套接字连接到我的后端。

2 个答案:

答案 0 :(得分:1)

您是否启用了INTERNET Android权限?

此外,ws4py有很多可能需要添加的依赖项。我可以看到特别是龙卷风,gevent和cython的问题。 https://github.com/Lawouach/WebSocket-for-Python/blob/master/requirements/py2kreqs.txt

答案 1 :(得分:1)

遇到同样的问题。将openssl添加到所需模块列表中可以解决问题(即buildozer.spec中的'requirements = openssl,ws4py,kivy')。

它帮助使用snakefood列出python脚本加载的每个模块。有关详细信息,请参阅list python package dependencies without loading them?