Kivy应用程序需要30秒才能打开 [英] Kivy app takes 30 seconds to open

查看:64
本文介绍了Kivy应用程序需要30秒才能打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在iOS和Android设备上打开Kivy应用大约需要30秒(在Mac OSX上打开仅需要3秒...在Windows上还没有尝试过). kivy-ios软件包用于构建iOS应用程序,buildozer用于构建Android应用程序.

It is taking about 30 seconds to open a Kivy app on iOS and Android devices (it takes only 3 seconds to open on Mac OSX... haven't tried it on Windows). The kivy-ios package is used to build the app for iOS and buildozer is used to build the app for Android.

下面是在iPhone上打开应用程序的控制台日志.我不知道是什么原因导致启动时间缓慢.

The console log for opening the app on an iPhone is below. I'm at a loss as to what is causing the slow start time.

Aug 19 13:29:29 My-iPhone kernel[0] <Debug>: launchd[2943] Container: /private/var/mobile/Applications/5CCB9A16-0288-4075-8269-212FD5AB2767 (sandbox)
Aug 19 13:29:29 My-iPhone backboardd[28] <Error>: HID: The 'Passive' connection 'my_app' access to protected services is denied.
Aug 19 13:29:30 My-iPhone my_app[2943] <Warning>: PythonHome is: /var/mobile/Applications/5CCB9A16-0288-4075-8269-212FD5AB2767/my_app.app
Aug 19 13:29:30 My-iPhone my_app[2943] <Warning>: Initializing python
Aug 19 13:29:31 My-iPhone my_app[2943] <Warning>: Running main.pyo: /var/mobile/Applications/5CCB9A16-0288-4075-8269-212FD5AB2767/my_app.app/YourApp/main.pyo
Aug 19 13:29:31 My-iPhone backboardd[28] <Warning>: CoreAnimation: timed out fence 2caa7
Aug 19 13:29:31 My-iPhone SpringBoard[34] <Warning>: CoreAnimation: failed to receive fence reply: 10004003
Aug 19 13:29:31 My-iPhone backboardd[28] <Warning>: CoreAnimation: updates deferred for too long

该应用程序在首次启动和随后的启动过程中将花费将近30秒的时间.

The app takes almost 30 seconds to open on first launch and on subsequent launches.

推荐答案

正如Ryan P在评论中所说,第一次运行会花费更长的时间,但不需要30秒.

As Ryan P said in a comment, the first run will take longer, but it shouldn't need 30s.

通常很重要的一件事是,应用程序不仅要进行一些必要的拆包(在第一次运行时)和应用程序初始化(在每次运行时),而且还要运行main.py和应用程序构建中的任何代码( ) 方法.如果这很重要,则需要一些时间,但是在此期间用户将看不到任何内容.您可以通过仅以最小的gui开头并更懒地加载其余gui来避免该问题.

One thing that's often important is that the app not only does some necessary unpacking (on the first run) and app initialisation (on every run), but also runs the code in your main.py and anything in the app build() method. If this is significant, it will take some time, but the user won't see anything during this time. You can avoid that problem by starting with only a minimal gui and loading the rest more lazily.

您可能还想将性能与其他kivy应用进行比较,例如 kivy 2048 .我不知道Mathieu是否特别花了很多时间对此进行优化,但是它的行为至少应该非常合理.如果加载速度比您的加载速度快得多,则问题出在您的代码/apk.

You may also want to benchmark your performance against another kivy app, such as the kivy 2048 on the play store. I don't know if Mathieu spent much time optimising for this in particular, but it should behave at least very reasonably. If it's much faster to load than yours, the problem lies with your code/apk.

我们通常建议kivy的启动时间不应该超过几秒钟(尤其是在第一次运行之后),对于较新的设备上的应用程序,通常需要不到一秒钟的时间.

We usually suggest that kivy should need no more than a small number of seconds to do its init (especially after the first run), often less than a second for apps on newer devices that are careful about it.

我应该澄清以上内容是基于我对Kivy的android工具链的了解.我不了解ios的任何细节,尽管它非常相似,并且您可以期望相似的事情很重要.

I should clarify that the above is from my knowledge of Kivy's android toolchain. I don't know about any of the specifics of ios, though it's something very similar and you can expect similar things to be important.

这篇关于Kivy应用程序需要30秒才能打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆