0

I am creating an app using python and kivy using from tinydb import TinyD, Query to import the tinydb module. This works completely fine when testing my python and kivy code. After using buildozer to create an apk and debugging, it is saying that it crashed because of ImportError: no module named tinydb. I tried adding tinydb as a requiremenet in buildozer.spec, but that did not fix it. I'm fairly certain that I need to install tinydb in my App directory, this way the package is downloaded and included in my APK. However, I'm not quite sure how to do this. For example I installed the graph module from kivy garden using garden install --app graph. If anyone has any suggestions that would be great!

4

1 回答 1

2

我从未使用过 buildover,但由于 tinydb 是一个很小的纯 python 库,您可能可以直接下载 tinydb 库并将其包含在您的项目中并在本地导入。

我使用了以下目录结构

│   app.py
├───db
│       db.json
└───tinydb
    │   database.py
    │   middlewares.py
    │   operations.py
    │   queries.py
    │   storages.py
    │   utils.py
    │   __init__.py

和主脚本 app.py

from tinydb import TinyDB, Query
import os

dirname = os.path.dirname(os.path.abspath(__file__))
db = TinyDB(os.path.join(dirname, 'db', 'db.json'))
于 2016-04-29T00:38:24.530 回答