Android kivy 在哪里放置应用程序文件(ini、images db 等)

Android kivy where to put application files (ini, images db etc)(Android kivy 在哪里放置应用程序文件(ini、images db 等))
本文介绍了Android kivy 在哪里放置应用程序文件(ini、images db 等)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用 kivy 为 Android 创建了一个原型应用程序.它已在 buildozer 中编译,我已上传到 Android 设备.

I've created a prototype application for Android using kivy. It has compiled in buildozer and I've uploaded in to an Android device.

但我不确定将应用程序相关文件(如 ini 文件、图像数据库等)放在哪里.

But I'm nor sure where to put app dependent files like the ini file, images database etc.

非常感谢任何帮助

当我问这个问题时(很多个月前),我对 kivy 和 buildozer 的整个想法都是新手.

When I asked this question (many moons ago) I was new to kivy and the whole idea of buildozer.

我没有意识到以及对于初学者来说不明显的事情(见证这个问题被查看的次数)以及 @inclement 的答案没有解决的问题是 Buildozer 将整个 python/kivy 项目包装到一个可以包含所有 static 数据的文件.因此,您只需要确保您的 buildozer 规范能够接受它们.

What I didn't realise and what isn't obvious to a beginner (witness the number of times this question has been viewed) and which @inclement's answer does not address, is that Buildozer wraps the whole python/kivy project into a single file which can include all of your static data. So you just need to make sure your buildozer spec picks them up.

推荐答案

您可以安排他们品尝 - 只要您告诉 buildozer 包含它们 apk(即通过设置要包含的文件类型、目录等)并访问它们在您的代码中具有相对路径,它们将在设备上以相同的方式工作.

You can arrange them to taste - as long as you tell buildozer to include them apk (i.e. by setting the file types, directories etc to be included) and access them with relative paths in your code, they will work the same way on the device.

ini 文件可能是一个例外,我不确定 kivy 尝试从哪里加载它(但它可能位于外部数据目录中的某个位置).如果将它放在与 main.py 相同的目录不起作用,也许您可​​以使用相对路径手动加载它,或者如果它只有几个值,那么您可以在 main.py 文件中设置它们.

The ini file may be an exception, I'm not sure offhand where kivy tries to load it from (but it may be somewhere in the external data dir). If putting it in the same directory as main.py doesn't work, maybe you could load it manually with a relative path, or if it has just a few values then you could set them in the main.py file.

这篇关于Android kivy 在哪里放置应用程序文件(ini、images db 等)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How to target newer versions in .gitlab-ci.yml using auto devops (java 11 instead of 8 and Android 31 instead of 29)(如何在.gitlab-ci.yml中使用自动开发工具(Java 11而不是8,Android 31而不是29)瞄准较新的版本)
Android + coreLibraryDesugaring: which Java 11 APIs can I expect to work?(Android+core LibraryDesugering:我可以期待哪些Java 11API能够工作?)
How to render something in an if statement React Native(如何在If语句中呈现某些内容Reaction Native)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)
Using Firebase Firestore in offline only mode(在仅脱机模式下使用Firebase FiRestore)
Crash on Google Play Pre-Launch Report: java.lang.NoSuchMethodError(Google Play发布前崩溃报告:java.lang.NoSuchMethodError)