在android python应用程序上使用paramiko

时间:2016-05-18 00:19:34

标签: android python kivy paramiko kivy-language

我正在使用buildozer来编译Python应用程序,我可以毫无问题地构建APK。 在我要求的要求中:

# (list) Application requirements
# comma seperated e.g. requirements = sqlite3,kivy
requirements = sqlite3,kivy,datetime,plyer,paramiko

但该应用程序无法启动。如果我评论“import paramiko”这一行,应用程序启动,但显然不是我的选择。在PC上paramiko工作没有问题。 我知道,例如,sqlite3必须在kivy之前提出要求,对吧?我尝试了许多不同的选项,如“sqlite3,paramiko,kivy,datetime,plyer”或“sqlite3,kivy,paramiko,datetime,plyer”。我该怎么办?

版:

Not sure if i did correctly but... I enable developer option on my phone, the adb logcat, run the App on the phone then I got: 

    05-18 10:21:49.755 20436 20436 V python  : metadata fullscreen is0
05-18 10:21:49.966 20436 20449 I python  : Starting audio thread
05-18 10:21:50.053 20436 20452 I python  : presplash-fit is null
05-18 10:21:50.054 20436 20452 I python  : presplash (fit=null) mx=0,450000,my=0,710000
05-18 10:21:50.073 20436 20452 I python  : Initialize Python for Android
05-18 10:21:50.275 20436 20452 I python  : ['/data/user/0/com.doatlanticoaopacifico.dap/files/lib/python2.7/site-packages', '/data/user/0/com.doatlanticoaopacifico.dap/files/lib/site-python']
05-18 10:21:50.275 20436 20452 I python  : Android path ['/data/user/0/com.doatlanticoaopacifico.dap/files/lib/python27.zip', '/data/user/0/com.doatlanticoaopacifico.dap/files/lib/python2.7', '/data/user/0/com.doatlanticoaopacifico.dap/files/lib/python2.7/lib-dynload', '/data/user/0/com.doatlanticoaopacifico.dap/files/lib/python2.7/site-packages', '/storage/emulated/0/com.doatlanticoaopacifico.dap', '/storage/emulated/0/com.doatlanticoaopacifico.dap/_applibs']
05-18 10:21:50.275 20436 20452 I python  : Android kivy bootstrap done. __name__ is __main__
05-18 10:21:50.275 20436 20452 I python  : Run user program, change dir and execute main.py
05-18 10:21:50.592 20436 20452 I python  : [INFO              ] [Logger      ] Record log in /storage/emulated/0/com.doatlanticoaopacifico.dap/.kivy/logs/kivy_16-05-18_5.txt
05-18 10:21:50.593 20436 20452 I python  : [INFO              ] [Kivy        ] v1.9.1
05-18 10:21:50.593 20436 20452 I python  : [INFO              ] [Python      ] v2.7.2 (default, May 17 2016, 21:38:56) 
05-18 10:21:50.593 20436 20452 I python  : [GCC 4.8]
05-18 10:21:50.669 20436 20452 I python  : [INFO              ] [Factory     ] 179 symbols loaded
05-18 10:21:51.682 20436 20452 I python  :  /data/user/0/com.doatlanticoaopacifico.dap/files/lib/python2.7/site-packages/kivy/core/image/img_pygame.py:13: RuntimeWarning: import cdrom: No module named cdrom
05-18 10:21:51.683 20436 20452 I python  :  (ImportError: No module named cdrom)
05-18 10:21:51.728 20436 20452 I python  : [INFO              ] [Image       ] Providers: img_tex, img_dds, img_gif, img_pygame (img_pil, img_ffpyplayer ignored)
05-18 10:21:53.083 20436 20452 I python  : [INFO              ] [Window      ] Provider: pygame
05-18 10:21:53.101 20436 20452 I python  : [INFO              ] [GL          ] OpenGL version <OpenGL ES 3.0 V@140.0 AU@  (GIT@I14a17c7611)>
05-18 10:21:53.102 20436 20452 I python  : [INFO              ] [GL          ] OpenGL vendor <Qualcomm>
05-18 10:21:53.102 20436 20452 I python  : [INFO              ] [GL          ] OpenGL renderer <Adreno (TM) 306>
05-18 10:21:53.103 20436 20452 I python  : [INFO              ] [GL          ] OpenGL parsed version: 3, 0
05-18 10:21:53.105 20436 20452 I python  : [INFO              ] [GL          ] Texture max size <4096>
05-18 10:21:53.106 20436 20452 I python  : [INFO              ] [GL          ] Texture max units <16>
05-18 10:21:53.174 20436 20452 I python  : [INFO              ] [Shader      ] program: <--From Vertex Shader:
05-18 10:21:53.174 20436 20452 I python  : --From Fragment Shader:
05-18 10:21:53.174 20436 20452 I python  : Link was successful.>
05-18 10:21:54.114 20436 20452 I python  : [INFO              ] [Support     ] Android install hooks
05-18 10:21:54.116 20436 20452 I python  : [INFO              ] [Window      ] virtual keyboard not allowed, single mode, not docked
05-18 10:21:54.142 20436 20452 I python  : [INFO              ] [Text        ] Provider: pygame
05-18 10:21:54.440 20436 20452 I python  :  Traceback (most recent call last):
05-18 10:21:54.441 20436 20452 I python  :    File "/home/awulll/dapapp/.buildozer/android/app/main.py", line 12, in <module>
05-18 10:21:54.442 20436 20452 I python  :    File "/home/awulll/dapapp/.buildozer/android/app/rotinas.py", line 11, in <module>
05-18 10:21:54.443 20436 20452 I python  :    File "/home/awulll/dapapp/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/site-packages/paramiko/__init__.py", line 30, in <module>
05-18 10:21:54.444 20436 20452 I python  :    File "/home/awulll/dapapp/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/site-packages/paramiko/transport.py", line 59, in <module>
05-18 10:21:54.445 20436 20452 I python  :    File "/home/awulll/dapapp/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/site-packages/paramiko/ecdsakey.py", line 26, in <module>
05-18 10:21:54.445 20436 20452 I python  :  ImportError: No module named ecdsa
05-18 10:21:54.516 20436 20452 I python  : Python for android ended.

第2版:

使用adb logcat | grep python(我可以从终端复制的内容):

    enter code here05-18 10:40:32.601 26849 26864 W linker  : /data/app/com.doatlanticoaopacifico.dap-1/lib/arm/libpython2.7.so: is missing DT_SONAME will use basename as a replacement: "libpython2.7.so"
05-18 10:40:32.625 26849 26864 W linker  : /data/data/com.doatlanticoaopacifico.dap/files/lib/python2.7/lib-dynload/_io.so: is missing DT_SONAME will use basename as a replacement: "_io.so"
05-18 10:40:32.642 26849 26864 W linker  : /data/data/com.doatlanticoaopacifico.dap/files/lib/python2.7/lib-dynload/unicodedata.so: is missing DT_SONAME will use basename as a replacement: "unicodedata.so"
05-18 10:40:32.682 26849 26864 W linker  : /data/data/com.doatlanticoaopacifico.dap/files/lib/python2.7/lib-dynload/_sqlite3.so: is missing DT_SONAME will use basename as a replacement: "_sqlite3.so"
05-18 10:40:32.688 26849 26864 I python  : Starting audio thread
05-18 10:40:32.709 26849 26882 I python  : Initialize Python for Android
05-18 10:40:32.974 26849 26882 I python  : ['/data/user/0/com.doatlanticoaopacifico.dap/files/lib/python2.7/site-packages', '/data/user/0/com.doatlanticoaopacifico.dap/files/lib/site-python']
05-18 10:40:32.974 26849 26882 I python  : Android path ['/data/user/0/com.doatlanticoaopacifico.dap/files/lib/python27.zip', '/data/user/0/com.doatlanticoaopacifico.dap/files/lib/python2.7', '/data/user/0/com.doatlanticoaopacifico.dap/files/lib/python2.7/lib-dynload', '/data/user/0/com.doatlanticoaopacifico.dap/files/lib/python2.7/site-packages', '/storage/emulated/0/com.doatlanticoaopacifico.dap', '/storage/emulated/0/com.doatlanticoaopacifico.dap/_applibs']
05-18 10:40:32.974 26849 26882 I python  : Android kivy bootstrap done. __name__ is __main__
05-18 10:40:32.974 26849 26882 I python  : Run user program, change dir and execute main.py
05-18 10:40:33.119 26849 26882 W linker  : /data/data/com.doatlanticoaopacifico.dap/files/lib/python2.7/lib-dynload/_hashlib.so: is missing DT_SONAME will use basename as a replacement: "_hashlib.so"
05-18 10:40:33.331 26849 26882 I python  : [ERROR             ] Error when copying logo directory
05-18 10:40:33.331 26849 26882 I python  : Traceback (most recent call last):
05-18 10:40:33.331 26849 26882 I python  :   File "/home/awulll/dapapp/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/site-packages/kivy/__init__.py", line 301, in <module>
05-18 10:40:33.331 26849 26882 I python  :   File "/home/awulll/dapapp/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/shutil.py", line 205, in copytree
05-18 10:40:33.331 26849 26882 I python  : Error: [('/data/user/0/com.doatlanticoaopacifico.dap/files/lib/python2.7/site-packages/kivy/data/logo/kivy-icon-64.png', '/storage/emulated/0/com.doatlanticoaopacifico.dap/.kivy/icon/kivy-icon-64.png', "[Errno 1] Operation not permitted: '/storage/emulated/0/com.doatlanticoaopacifico.dap/.kivy/icon/kivy-icon-64.png'"), ('/data/user/0/com.doatlanticoaopacifico.dap/files/lib/python2.7/site-packages/kivy/data/logo/kivy-icon-512.png', '/storage/emulated/0/com.doatlanticoaopacifico.dap/.kivy/icon/kivy-icon-512.png', "[Errno 1] Operation not permitted: '/storage/emulated/0/com.doatlanticoaopacifico.dap/.kivy/icon/kivy-icon-512.png'"), ('/data/user/0/com.doatlanticoaopacifico.dap/files/lib/python2.7/site-packages/kivy/data/logo/kivy-icon-256.png', '/storage/emulated/0/com.doatlanticoaopacifico.dap/.kivy/icon/kivy-icon-256.png', "[Errno 1] Operation not permitted: '/storage/emulated/0/com.doatlanticoaopacifico.dap/.kivy/icon/kivy-icon-256.png'"), ('/data/user/0/com.doatlanticoaopacifico.dap/files/lib/python2.7/site-packages/kivy/data/logo/kivy-icon-32.png', '/storage/emulated/0/com.doatlanticoaopacifico.dap/.kivy/icon/kivy-icon-32.png', "[Errno 1] Operation not permitted: '/storage/emulated/0/com.doatlanticoaopacifico.dap/.kivy/icon/kivy-icon-32.png'"), ('/data/user/0/com.doatlanticoaopacifico.dap/files/lib/python2.7/site-packages/kivy/data/logo/kivy-icon-24.png', '/storage/emulated/0/com.doatlanticoaopacifico.dap/.kivy/icon/kivy-icon-24.png', "[Errno 1] Operation not permitted: '/storage/emulated/0/com.doatlanticoaopacifico.dap/.kivy/icon/kivy-icon-24.png'"), ('/data/user/0/com.doatlanticoaopacifico.dap/files/lib/python2.7/site-packages/kivy/data/logo/kivy-icon-128.png', '/storage/emulated/0/com.doatlanticoaopacifico.dap/.kivy/icon/kivy-icon-128.png', "[Errno 1] Operation not permitted: '/storage/emulated/0/com.doatlanticoaopacifico.dap/.kivy/icon/kivy-icon-128.png'"), ('/data/user/0/com.doatlanticoaopacifico.dap/files/lib/python2.7/site-packages/kivy/data/logo/kivy-icon-48.png', '/storage/emulated/0/com.doatlanticoaopacifico.dap/.kivy/icon/kivy-icon-48.png', "[Errno 1] Operation not permitted: '/storage/emulated/0/com.doatlanticoaopacifico.dap/.kivy/icon/kivy-icon-48.png'"), ('/data/user/0/com.doatlanticoaopacifico.dap/files/lib/python2.7/site-packages/kivy/data/logo/kivy-icon-16.png', '/storage/emulated/0/com.doatlanticoaopacifico.dap/.kivy/icon/kivy-icon-16.png', "[Errno 1] Operation not permitted: '/storage/emulated/0/com.doatlanticoaopacifico.dap/.kivy/icon/kivy-icon-16.png'"), '/data/user/0/com.doatlanticoaopacifico.dap/files/lib/python2.7/site-packages/kivy/data/logo', '/storage/emulated/0/com.doatlanticoaopacifico.dap/.kivy/icon', "[Errno 1] Operation not permitted: '/storage/emulated/0/com.doatlanticoaopacifico.dap/.kivy/icon'"]
05-18 10:40:33.353 26849 26882 I python  : [WARNING           ] [Config      ] Older configuration version detected (0 instead of 14)
05-18 10:40:33.354 26849 26882 I python  : [WARNING           ] [Config      ] Upgrading configuration in progress.
05-18 10:40:33.372 26849 26882 I python  : [INFO              ] [Logger      ] Record log in /storage/emulated/0/com.doatlanticoaopacifico.dap/.kivy/logs/kivy_16-05-18_0.txt
05-18 10:40:33.373 26849 26882 I python  : [INFO              ] [Kivy        ] v1.9.1
05-18 10:40:33.373 26849 26882 I python  : [INFO              ] [Python      ] v2.7.2 (default, May 17 2016, 21:38:56) 
05-18 10:40:33.373 26849 26882 I python  : [GCC 4.8]
05-18 10:40:33.391 26849 26882 W linker  : /data/data/com.doatlanticoaopacifico.dap/files/lib/python2.7/lib-dynload/_ctypes.so: is missing DT_SONAME will use basename as a replacement: "_ctypes.so"
05-18 10:40:33.436 26849 26882 I python  : [INFO              ] [Factory     ] 179 symbols loaded
05-18 10:40:34.414 26849 26882 I python  :  /data/user/0/com.doatlanticoaopacifico.dap/files/lib/python2.7/site-packages/kivy/core/image/img_pygame.py:13: RuntimeWarning: import cdrom: No module named cdrom
05-18 10:40:34.415 26849 26882 I python  :  (ImportError: No module named cdrom)
05-18 10:40:34.460 26849 26882 I python  : [INFO              ] [Image       ] Providers: img_tex, img_dds, img_gif, img_pygame (img_pil, img_ffpyplayer ignored)
05-18 10:40:35.702 26849 26882 I python  : [INFO              ] [Window      ] Provider: pygame
05-18 10:40:35.718 26849 26882 I python  : [INFO              ] [GL          ] OpenGL version <OpenGL ES 3.0 V@140.0 AU@  (GIT@I14a17c7611)>
05-18 10:40:35.718 26849 26882 I python  : [INFO              ] [GL          ] OpenGL vendor <Qualcomm>
05-18 10:40:35.719 26849 26882 I python  : [INFO              ] [GL          ] OpenGL renderer <Adreno (TM) 306>
05-18 10:40:35.720 26849 26882 I python  : [INFO              ] [GL          ] OpenGL parsed version: 3, 0
05-18 10:40:35.721 26849 26882 I python  : [INFO              ] [GL          ] Texture max size <4096>
05-18 10:40:35.722 26849 26882 I python  : [INFO              ] [GL          ] Texture max units <16>
05-18 10:40:35.791 26849 26882 I python  : [INFO              ] [Shader      ] program: <--From Vertex Shader:
05-18 10:40:35.791 26849 26882 I python  : --From Fragment Shader:
05-18 10:40:35.791 26849 26882 I python  : Link was successful.>
05-18 10:40:36.725 26849 26882 I python  : [INFO              ] [Support     ] Android install hooks
05-18 10:40:36.727 26849 26882 I python  : [INFO              ] [Window      ] virtual keyboard not allowed, single mode, not docked
05-18 10:40:36.746 26849 26882 I python  : [INFO              ] [Text        ] Provider: pygame
05-18 10:40:36.819 26849 26882 W linker  : /data/data/com.doatlanticoaopacifico.dap/files/lib/python2.7/lib-dynload/_ssl.so: is missing DT_SONAME will use basename as a replacement: "_ssl.so"
05-18 10:40:36.953 26849 26882 W linker  : /data/data/com.doatlanticoaopacifico.dap/files/lib/python2.7/site-packages/Crypto/Util/_counter.so: is missing DT_SONAME will use basename as a replacement: "_counter.so"
05-18 10:40:36.960 26849 26882 W linker  : /data/data/com.doatlanticoaopacifico.dap/files/lib/python2.7/site-packages/Crypto/Cipher/_AES.so: is missing DT_SONAME will use basename as a replacement: "_AES.so"
05-18 10:40:36.969 26849 26882 W linker  : /data/data/com.doatlanticoaopacifico.dap/files/lib/python2.7/site-packages/Crypto/Cipher/_DES3.so: is missing DT_SONAME will use basename as a replacement: "_DES3.so"
05-18 10:40:37.005 26849 26882 I python  :  Traceback (most recent call last):
05-18 10:40:37.006 26849 26882 I python  :    File "/home/awulll/dapapp/.buildozer/android/app/main.py", line 12, in <module>
05-18 10:40:37.006 26849 26882 I python  :    File "/home/awulll/dapapp/.buildozer/android/app/rotinas.py", line 11, in <module>
05-18 10:40:37.007 26849 26882 I python  :    File "/home/awulll/dapapp/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/site-packages/paramiko/__init__.py", line 30, in <module>
05-18 10:40:37.008 26849 26882 I python  :    File "/home/awulll/dapapp/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/site-packages/paramiko/transport.py", line 59, in <module>
05-18 10:40:37.009 26849 26882 I python  :    File "/home/awulll/dapapp/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/site-packages/paramiko/ecdsakey.py", line 26, in <module>
05-18 10:40:37.010 26849 26882 I python  :  ImportError: No module named ecdsa
05-18 10:40:37.080 26849 26882 I python  : Python for android ended.
05-18 10:40:37.157 26987 27003 I ActivityManager: Process com.doatlanticoaopacifico.dap:python (pid 26849) has died

1 个答案:

答案 0 :(得分:1)

我明白了!

我在要求上添加了ecdsa:

# (list) Application requirements
# comma seperated e.g. requirements = sqlite3,kivy
requirements = sqlite3,kivy,datetime,plyer,ecdsa,paramiko

我不知道它是否有任何区别,但我保留了我的权限:

android.permissions = INTERNET,ACCESS_NETWORK_STATE,CAMERA

谢谢你们!