在buildozer遇到了一些麻烦(事后看来,我现在可能可以解决了)之后,我成功地用Python-for-Android构建了Kivy .apk。感谢所有以前尝试解决这些问题的人员,我解决了许多其他问题,并推出了我的.apk版本,该版本不会超出预启动的范围。根据{{1}}的说法,该应用程序会运行除启动主循环之外的所有内容:
adb logcat
它只是无限期地结束在那儿,仍然在预告片上。
我用了这个:
I/python (10880): Android kivy bootstrap done. __name__ is __main__
I/python (10880): AND: Ran string
I/python (10880): Run user program, change dir and execute entrypoint
I/python (10880): main.py
I/python (10880): [INFO ] [Logger ] Record log in /data/data/org.kivy.dropprApp/files/app/.kivy/logs/kivy_18-07-12_3.txt
I/python (10880): [INFO ] [Kivy ] v1.10.0
I/python (10880): [INFO ] [Python ] v3.5.0 (default, Dec 24 2015, 05:56:40)
I/python (10880): [GCC 5.3 20151204]
I/python (10880): [INFO ] [Factory ] 194 symbols loaded
I/python (10880): [INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored)
I/python (10880): [INFO ] [Text ] Provider: sdl2
I/python (10880): [INFO ] [Audio ] Providers: audio_sdl2 (audio_ffpyplayer ignored)
I/python (10880): [INFO ] [OSC ] using <multiprocessing> for socket
I/python (10880): [INFO ] [Window ] Provider: sdl2
I/python (10880): [INFO ] [GL ] Using the "OpenGL ES 2" graphics system
I/python (10880): [INFO ] [GL ] Backend used <gl>
I/python (10880): [INFO ] [GL ] OpenGL version <b'OpenGL ES 2.0 14.01003'>
I/python (10880): [INFO ] [GL ] OpenGL vendor <b'NVIDIA Corporation'>
I/python (10880): [INFO ] [GL ] OpenGL renderer <b'NVIDIA Tegra 3'>
I/python (10880): [INFO ] [GL ] OpenGL parsed version: 2, 0
I/python (10880): [INFO ] [GL ] Texture max size <2048>
I/python (10880): [INFO ] [GL ] Texture max units <16>
I/python (10880): [INFO ] [Window ] auto add sdl2 input provider
I/python (10880): [INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
I/python (10880): [INFO ] [GL ] NPOT texture support is available
在32位Ubuntu 16.04计算机上使用适用于Android的Python创建.apk,然后在运行Android 5.1.1 Lollipop的(旧)Nexus 7上运行.apk。
这也是我代码的最后几行。 (整个过程太长了,我怀疑错误与这部分有关)
p4a apk --private /home/collin0599/Documents/Droppr/Droppr-0.20 --package=org.kivy.dropprApp --name "Droppr" --version 0.20 --bootstrap=sdl2 --requirements=kivy==1.9.0,openssl,python3crystax --android-api 19 --orientation portrait --icon /home/collin0599/Documents/Droppr/Droppr-0.20/droppr_icon.png --presplash /home/collin0599/Documents/Droppr/Droppr-0.20/presplash.png --ndk-dir /home/collin0599/Documents/Droppr/crystax-ndk-10.3.2 --arch=armeabi-v7a
KV_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), 'main'))
resource_add_path(KV_PATH)
class FallingBlocksApp(App):
"""Main App"""
def build(self):
Builder.load_file("main.kv")
sm = Manager()
sm.file_load()
Clock.schedule_once(lambda dt: sm.msBegin(), 2)
# sm.menuScreen.begin()
return sm
if __name__ == "__main__":
FallingBlocksApp().run()
只是我的ScreenManager中的一个函数,它在我的一个屏幕中调用一个函数。我以前遇到过麻烦,因为.kv文件未及时加载,这就是为什么它是由Clock安排的
任何帮助将不胜感激。我已经就这个问题进行了大约一个小时的研究,但没有任何进展。我真的很为难。预先感谢!
编辑:我还从技术上讲是用python 3.6编写的应用程序,但是我可以肯定代码中的任何内容都无法在3.5上运行。另外,我发现我收到此错误,提示msBegin()
Unsatisfied linker when loading ctypes
编辑2:我只是用buildozer重新构建了它,在这个新的错误之上,我也遇到了相同的错误:
E/art (30055): dlopen("/data/data/org.kivy.dropprApp/files/app/lib/python2.7/lib-dynload/_ctypes.so", RTLD_LAZY) failed: dlopen failed: library "/data/data/org.kivy.dropprApp/files/app/lib/python2.7/lib-dynload/_ctypes.so" not found
V/pythonutil(30055): Unsatisfied linker when loading ctypes
V/pythonutil(30055): Loaded everything!
V/PythonActivity(30055): Setting env vars for start.c and Python to use
V/PythonActivity(30055): Access to our meta-data...
I/PythonActivity(30055): Surface will NOT be transparent
同样的问题,没有越过预启动并启动主应用程序循环。这是我的 globals()[__func_name] = __get_hash(__func_name)
I/python (18954): File "/data/data/org.kivy.droppr.dropprapp/files/app/crystax_python/stdlib.zip/hashlib.py", line 113, in __get_builtin_constructor
I/python (18954): raise ValueError('unsupported hash type ' + name)
I/python (18954): ValueError: unsupported hash type blake2s
I/python (18954): ERROR:root:code for hash sha3_224 was not found.
I/python (18954): Traceback (most recent call last):
I/python (18954): File "/data/data/org.kivy.droppr.dropprapp/files/app/crystax_python/stdlib.zip/hashlib.py", line 243, in <module>
buildozer.spec