我在python3,kivy,google-api上做了一个程序(用于访问Google驱动器服务),并试图使其在我的android智能手机上运行。该程序可以在PC上正常运行,但是当我通过buildozer运行并获得apk程序包时,该程序立即崩溃。
一直以来,我一直将adb与logcat一起使用,发现在Android上它需要:httplib2(或其他完成的事情),然后是google-auth-oauth(也完成的事情)。现在,adb尖叫说找不到名为“ google.auth”的模块。无法解决这个问题。有没有办法告诉buildozer在哪里可以找到所有需要的库,或者有其他方法可以完成它。请帮助我。
带有adb的Logcat说:
08-04 13:23:11.849 13540 13584 I python : Android kivy bootstrap done. __name__ is __main__
08-04 13:23:11.849 13540 13584 I python : AND: Ran string
08-04 13:23:11.849 13540 13584 I python : Run user program, change dir and execute entrypoint
08-04 13:23:12.062 13540 13584 I python : [WARNING] [Config ] Older configuration version detected (0 instead of 21)
08-04 13:23:12.063 13540 13584 I python : [WARNING] [Config ] Upgrading configuration in progress.
08-04 13:23:12.070 13540 13584 I python : [INFO ] [Logger ] Record log in /data/user/0/org.test.tilisync/files/app/.kivy/logs/kivy_19-08-04_0.txt
08-04 13:23:12.071 13540 13584 I python : [INFO ] [Kivy ] v1.11.0
08-04 13:23:12.071 13540 13584 I python : [INFO ] [Kivy ] Installed at "/data/user/0/org.test.tilisync/files/app/_python_bundle/site-packages/kivy/__init__.pyc"
08-04 13:23:12.071 13540 13584 I python : [INFO ] [Python ] v3.7.1 (default, Aug 3 2019, 23:00:34)
08-04 13:23:12.071 13540 13584 I python : [Clang 6.0.2 (https://android.googlesource.com/toolchain/clang 183abd29fc496f55
08-04 13:23:12.072 13540 13584 I python : [INFO ] [Python ] Interpreter at "android_python"
08-04 13:23:12.935 13540 13584 I python : [INFO ] [Factory ] 184 symbols loaded
08-04 13:23:13.446 13540 13584 I python : [INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored)
08-04 13:23:13.504 13540 13584 I python : [INFO ] [Text ] Provider: sdl2
08-04 13:23:13.611 13540 13584 I python : [INFO ] [Window ] Provider: sdl2
08-04 13:23:13.648 13540 13584 I python : [INFO ] [GL ] Using the "OpenGL ES 2" graphics system
08-04 13:23:13.650 13540 13584 I python : [INFO ] [GL ] Backend used <sdl2>
08-04 13:23:13.650 13540 13584 I python : [INFO ] [GL ] OpenGL version <b'OpenGL ES 3.2 v1.r20p0-01rel0.9a7fca3f7dd712a473937294a8ae24b1'>
08-04 13:23:13.651 13540 13584 I python : [INFO ] [GL ] OpenGL vendor <b'ARM'>
08-04 13:23:13.651 13540 13584 I python : [INFO ] [GL ] OpenGL renderer <b'Mali-T830'>
08-04 13:23:13.651 13540 13584 I python : [INFO ] [GL ] OpenGL parsed version: 3, 2
08-04 13:23:13.652 13540 13584 I python : [INFO ] [GL ] Texture max size <8192>
08-04 13:23:13.652 13540 13584 I python : [INFO ] [GL ] Texture max units <16>
08-04 13:23:13.702 13540 13584 I python : [INFO ] [Window ] auto add sdl2 input provider
08-04 13:23:13.703 13540 13584 I python : [INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
08-04 13:23:13.939 13540 13584 I python : Traceback (most recent call last):
08-04 13:23:13.939 13540 13584 I python : File "/home/anton/Documents/tiliSync/tiliSync/.buildozer/android/app/main.py", line 15, in <module>
08-04 13:23:13.940 13540 13584 I python : File "/home/anton/Documents/tiliSync/tiliSync/.buildozer/android/app/gapi_cls.py", line 5, in <module>
08-04 13:23:13.941 13540 13584 I python : File "/home/anton/Documents/tiliSync/tiliSync/.buildozer/android/platform/build/build/python-installs/tilisync/google_auth_oauthlib/__init__.py", line 21, in <module>
08-04 13:23:13.941 13540 13584 I python : File "/home/anton/Documents/tiliSync/tiliSync/.buildozer/android/platform/build/build/python-installs/tilisync/google_auth_oauthlib/interactive.py", line 24, in <module>
08-04 13:23:13.942 13540 13584 I python : File "/home/anton/Documents/tiliSync/tiliSync/.buildozer/android/platform/build/build/python-installs/tilisync/google_auth_oauthlib/flow.py", line 67, in <module>
08-04 13:23:13.943 13540 13584 I python : ModuleNotFoundError: No module named 'google.auth'
08-04 13:23:13.943 13540 13584 I python : Python for android ended.
Buildozer规格:
# (list) Application requirements
# comma separated e.g. requirements = sqlite3,kivy
requirements = python3,kivy,google-api-python-client,google-oauth,google-auth-oauthlib,httplib2,uritemplate,openssl,google-cloud-storage,google-cloud-core,google-auth, google-auth-httplib2
应用目录:
anton@anton-VirtualBox:~/Documents/tiliSync/tiliSync$ ls
bin client_secret.json gapi_cls.py google_auth-1.6.3-py3.5-nspkg.pth lib my.kv six.py tilit.txt tst_upload.txt
buildozer.spec debug_log gapi_tests.py google_auth_httplib2.py main.py __pycache__ tiliSync.py token.pickle venv
认为以下问题:
from google-auth-oauthlib.flow import InstalledAppFlow
我正在使用python3在Ubuntu 18.04上