bug:flet build apk doesn't include files in assets folder
Duplicate Check
- [x] I have searched the opened issues and there are no duplicates
Describe the bug
Few days back when I used flet build apk it was including my files in assets folder and make my app call those files and run smoothly but now a days when I use flet build apk it doesn't include images and other files also are not included which makes my app failed to read or call those files so I need help pls
Code sample
Code
[Paste your code here]
To reproduce
Few days back when I used flet build apk it was including my files in assets folder and make my app call those files and run smoothly but now a days when I use flet build apk it doesn't include images and other files also are not included which makes my app failed to read or call those files so I need help pls.
Expected behavior
No response
Screenshots / Videos
Captures
[Upload media here]
Operating System
Windows
Operating system details
Windows 11
Flet version
Flet 0.28.3
Regression
No, it isn't
Suggestions
No response
Logs
Logs
[Paste your logs here]
Additional details
No response
+1
I also need a solution for that...
I've had the same issue. After creating the APK file and running it, the program can't read image files, mp3 files, etc. saved in the folder created within the assets folder.
Pls 🙏 help
Can you please try the latest pre-release and let know if the issue still happens?
Can you please try the latest pre-release and let know if the issue still happens?
The lastest pre-lease version seems to be 0.70.0.dev7031. However, the problem is that, while there was no problem before, a problem has been occurring recently in version 0.28.3. Is this problem due to the serious-python version?
Can you please try the latest pre-release and let know if the issue still happens?
I have tried the latest pre-release but the are some changes I meant there are thing that are different from 0.28.3. Which make my code or project failed example flet 0.28.3 it use ft.app(main) and pre-release use ft.run(main) and etc which can make me restart my project or to go through my codes and make changes. Pls help to fix flet 0.28.3 or any solution to this pls.
So it's not only me having this issue. I was being mad lol
Yes, I also encountered this problem when compiling .apk, and the problem is that it does not see the folder modules. If you put the entire project in the root, it works, but if you add it to folders, it stops seeing the module and gives an error. I tried using other versions of flet, but there is an error with serious-python.
Yes, I also encountered this problem when compiling .apk, and the problem is that it does not see the folder modules. If you put the entire project in the root, it works, but if you add it to folders, it stops seeing the module and gives an error. I tried using other versions of flet, but there is an error with serious-python.
If i put the entire project(image file, mp3 file, etc) in the root( with main.py file) it works??
Yes, I also encountered this problem when compiling .apk, and the problem is that it does not see the folder modules. If you put the entire project in the root, it works, but if you add it to folders, it stops seeing the module and gives an error. I tried using other versions of flet, but there is an error with serious-python.
If i put the entire project(image file, mp3 file, etc) in the root( with main.py file) it works??
yes
Yes, I also encountered this problem when compiling .apk, and the problem is that it does not see the folder modules. If you put the entire project in the root, it works, but if you add it to folders, it stops seeing the module and gives an error. I tried using other versions of flet, but there is an error with serious-python.
If i put the entire project(image file, mp3 file, etc) in the root( with main.py file) it works??
yes
Okay. I'll try. Thank you, so much.
Yes, I also encountered this problem when compiling .apk, and the problem is that it does not see the folder modules. If you put the entire project in the root, it works, but if you add it to folders, it stops seeing the module and gives an error. I tried using other versions of flet, but there is an error with serious-python.
If i put the entire project(image file, mp3 file, etc) in the root( with main.py file) it works??
yes
Okay. I'll try. Thank you, so much.
I Try to build apk. It doesn't work. .. Can you explain more detail, please?. I had tried do it for about 1 week. I have to build apk file.
Installing flet-cli 0.27.6 package...OK
[05:27:57] Flutter 3.27.4 installed ✅
[05:27:58] JDK installed ✅
Android SDK installed ✅
[05:28:07] Created Flutter bootstrap project from gh:flet-dev/flet-build-template with ref "0.27.6" ✅
[05:28:10] Because quizplease_flet depends on serious_python from git which doesn't exist (Could not find git ref 'hidden-files-fix' (fatal: ambiguous argument 'hidden-files-fix': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
)), version solving failed.
[05:28:22] Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.27.4, on Microsoft Windows [Version 10.0.26200.7462], locale ru-RU)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 36.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community 2026 Insiders [11222.16])
[√] Android Studio (version 2025.2.2)
[√] VS Code (version 1.107.0)
[√] Connected device (3 available)
[√] Network resources
• No issues found!
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Error building Flet app - see the log of failed command above. ```
Yes, I also encountered this problem when compiling .apk, and the problem is that it does not see the folder modules. If you put the entire project in the root, it works, but if you add it to folders, it stops seeing the module and gives an error. I tried using other versions of flet, but there is an error with serious-python.
If i put the entire project(image file, mp3 file, etc) in the root( with main.py file) it works??
yes
Okay. I'll try. Thank you, so much.
I Try to build apk. It doesn't work. .. Can you explain more detail, please?. I had tried do it for about 1 week. I have to build apk file.
Thank you so much!! Some of it was successful.
As you described, I copied the image and font files to the same folder as main.py and built the APK file. When I installed the APK file on my Android device, the image files were applied.
However, the font files are not.
When I ran the .py file before creating the APK file, the fonts were applied, but when I built the APK file, installed it on Android, and ran it, the fonts were not applied . Unlike image files, it seems that font files must be placed in the flet assets folder to be applied. If you know how to do this, please help.
For those having an issue, please can you comeup with a repo or zip file, containing a simple app, so we can try to repro the issue?
For those having an issue, please can you comeup with a repo or zip file, containing a simple app, so we can try to repro the issue?
For example, I prepared a repository with a simple project: https://github.com/Ambassador-of-programming/quizplease_Flet
When compiling flet build apk, it successfully compiles the .apk file, but when I try to run it on an Android device, it gives an error saying that it cannot find the folder. You only need to save the files in the root directory for everything to work successfully.
flet build apk
Installing flet-cli 0.28.3 package...OK
[04:43:07] Flutter 3.29.2 installed ✅
[04:43:08] JDK installed ✅
Android SDK installed ✅
[04:43:14] Created Flutter bootstrap project from gh:flet-dev/flet-build-template with ref "0.28.3" ✅
[04:44:52] Packaged Python app ✅
[04:45:10] Generated app icons ✅
[04:45:17] Generated splash screens ✅
[04:51:45] Built .apk for Android ✅
Copied build to build\apk directory ✅
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Successfully built your .apk for Android! 🥳 Find it in build\apk directory. 📁
When launching on an Android mobile device, the following error appears:
Traceback (most recent call last):
File "<string>", line 95, in <module>
File "<frozen runpy>", line 229, in run_module
File "<frozen runpy>", line 88, in _run_code
File "/data/user/0/com.mycompany.myapp/files/flet/app/main.py", line 2, in <module>
from router.FletRouter import Router
ModuleNotFoundError: No module named 'router'
Link to download the .apk file: https://transfiles.ru/vqw2n
I also noticed that if you use a different version of flet to build the .apk file, it gives the following error:
flet build apk
Installing flet-cli 0.27.6 package...OK
[05:05:20] Flutter 3.27.4 installed ✅
JDK installed ✅
Android SDK installed ✅
[05:05:29] Created Flutter bootstrap project from gh:flet-dev/flet-build-template with ref "0.27.6" ✅
[05:05:32] Because myapp depends on serious_python from git which doesn't exist (Could not find git ref 'hidden-files-fix' (fatal: ambiguous argument 'hidden-files-fix': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
)), version solving failed.
[05:05:41] Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.27.4, on Microsoft Windows [Version 10.0.26200.7462], locale ru-RU)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 36.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community 2026 Insiders [11222.16])
[√] Android Studio (version 2025.2.2)
[√] VS Code (version 1.107.1)
[√] Connected device (3 available)
[√] Network resources
• No issues found!
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Error building Flet app - see the log of failed command above.
Recently, while researching the cause of the problem, I found the error and solution for flutter to package custom modules correctly.
1 - Create the "app" folder inside "src" and move "main.py" into the app folder. Also, place your folders with your organized modules inside the src folder. (Do not touch the assets folder if your app work).
2 - Don't forget to create "init.py" inside the app folder created in step 1. 3 - Modify "pyproject.toml" by changing the path from "[tool.flet.app]" to "path = "src/app"" 4 - Run the command "flet build apk" 6 - Done! Your apk will run correctly...
Reasons that caused the "Module not found error":
Unpacking the apk, checking the app.zip located in "assets/flutter_assets/app/app.zip".
Finally, after unpacking the app.zip file, flat was moving the modules from their folders and literally naming them after the module as if it were the file name. For example, the file "routes.py" that was inside the "modules" folder ended up in the root directory with the name "modules\routes.py", so the modules folder was left empty. I don't know why...
working... thank you
The issue with wrong path separators inside app.zip when packaged on Windows has been solved. Please delete build directory inside app's directory before re-building the app.