No module named 'pydantic' on android
Duplicate Check
- [x] I have searched the opened issues and there are no duplicates
Describe the bug
I have a project using 0.27.6. I successfully run using command "flet run --android", and the app does well on android. But when I use "flet build apk" to build an apk file and install on the phone, when I run it, the app crashed:
Traceback (most recent call last):
File "
Should I do some extra config to include pydantic?
Code sample
Code
[Paste your code here]
To reproduce
flet build apk
Expected behavior
No response
Screenshots / Videos
Captures
[Upload media here]
Operating System
macOS
Operating system details
android
Flet version
0.27.6
Regression
No, it isn't
Suggestions
No response
Logs
Logs
[Paste your logs here]
Additional details
No response
Share your build config, and verbose (--v) logs.
demo project that can reproduce this problem: https://github.com/ismlsmile/flet-demo
I gave the latest pre-release a try and it worked. You can leave the version constrain on pydantic unspecified and the latest supported version will be picked. Please give it a try and let know how it works out.
src/main.py
import flet as ft
import pydantic
def main(page: ft.Page):
page.vertical_alignment = ft.MainAxisAlignment.CENTER
page.horizontal_alignment = ft.CrossAxisAlignment.CENTER
page.add(ft.Text(f"Pydantic version: {pydantic.__version__}", size=30))
ft.run(main)
pyproject.toml
dependencies = [
"flet >=0.70.0.dev0",
"pydantic",
]
[dependency-groups]
dev = [
"flet[all] >=0.70.0.dev0",
]
[tool.uv]
prerelease = "allow"
[tool.flet.app]
path = "src"
Screenshot
after running the app with flet debug