Closed Jorge-lopz closed 9 months ago
I cannot reproduce the problem with the given code... The app runs fine. Except the text Welcome to ... does not appear. Change the return of BlackORWhiteText
to ft.colors.WHITE
and ft.colors.BLACK
. Actually, the values of ft.colors.WHITE
(and the other one) is "white"
and "black"
, not "WHITE"
or "BLACK"
. Try this solution...
Wait, you built the app and it worked?
Building the app rn, I'll let you know as soon as it finishes.
Nope. I hope it works 🥹
Also, @Paco-Rubio did you make the changes I told in my above comments?
I changed the BlackORWhiteText function. I also changed any "black", "white", "dark" and "light" I could find to the corresponding flet expression and..... IT WORKED!!!
I'm going to apply the same concept to the full project (that is way bigger than this code), and if it works I'll then close the issue.
Btw, I have two doubts you might be able to answer @taaaf11 : 1 - Could I move functions like 'welcome' or 'BlackORWhiteText' to separate python files? (To better organise the code into separate files ("main.py", "styles.py", "views.py")? Will the built app have access to all of them after importing them?
2 - How can i change the name of the installed apk on the phone (both the name shown during installation and the final app name)?
Anyways, it finally works on both Windows and Android!! I can't believe the smallest mistake can cause such trouble. Thanks a lot @taaaf11 .
@Paco-Rubio Is the apk on your android working fine?
@Paco-Rubio
Btw, I have two doubts you might be able to answer
flet.exe
, you can have a look at them. Try with --project
options. The name of the directory (or folder) in which you are having "reduces" into app name. This is what I've observed.P.S: Tell me when --project
works for you... It is something I am struggling with too. And the app just gets the name of the "main" directory in lowercase.
Okk, again, thanks a lot, closing this issue now.
I guess dealing with "white", "blank" or "black" screens is getting high priority now. :) We need to see a proper error if something goes wrong.
Ok, can confirm that putting the project back together and building it still doesn't work.
I have applied changes to all "black", "white", "dark" and "light" occurrences, but still nothing. I'm trying to gradually simplify the code to see what actually breaks the app.
I guess dealing with "white", "blank" or "black" screens is getting high priority now. :) We need to see a proper error if something goes wrong.
@FeodorFitsner I think "raise" a warning when user gives unexpected values like, "BLACK"
instead of "black"
, so that this can prevent heavy confusions...
Update, i was able to build a different simplified version of the app (*) . After this, I kept adding some other parts to the code to progressively complicate it and test the app every time (the built version that is).
Everything was going good, too good to be true, but then I turn of my computer.
Now I start it again and, just to check, i build the app again (no changes made since the last correctly built version) and... It doesn't work.
I really don't understand, now not even the simplified version from the start works. @FeodorFitsner @taaaf11
@Paco-Rubio You can have a conversation with me on my email, if you want to... This issue is going long... here is my mail taafuuu@gmail.com
. Create a repo that contains the simplified version of the code. I will review it...
Is there any updates on this thread? If anyone has found the solution to this issue, I would appreciate it if you share it. I'm having the same issue with my app.
"flet build windows" and "flet build apk" both result in blank app windows. flet pack and pyinstaller work great in the meantime.
@jsyoo3722 Create a repository with the repro code so that I can review it.
Ok, update, this time a positive one, i guess... @jsyoo3722 After literal days of testing and compiling, I finally found the error.
Turns out that using this line in your code breaks the compiled app (both windows and apk): 'from flet.security import encrypt, decrypt'. The reason it took me so long to figure it out was that this exact line was copied from the official flet documentation (https://flet.dev/docs/guides/python/encrypting-sensitive-data#encrypting-data). I also had the required dependencies (cryptography) installed.
Combining the "white" and "black" fixes and removing this import fixed the issue and I'm now able to compile my entire codebase into a fully functioning app.
If any more help is needed or any other questions arise regarding this topic, @ me and I'll be willing to help.
@taaaf11 Thank you for your kind offer, but I'll try digging up and try to figure out which code is causing the error by adding each line of codes from the scratch. It's just an app that I'm creating for fun anywas. So, I'll do some more work myself before wasting your time. I really appreciate your offer.
@Paco-Rubio Thank you for sharing what you have found out. I'll just try doing the same thing, and share what happened to cause the error in my case.
@jsyoo3722 Like I mentioned my mail above, you can ask me any time without hesitance.
Try building app with the latest Flet 0.19.0. It has error reporting now if the app could not be started.
Try building app with the latest Flet 0.19.0. It has error reporting now if the app could not be started.
Where can I see these "error reportings"? Have same issue: successfully build .apk, but got blank white screen. And Iv even tested it on blank project aka "flet create ." - same issue
Can i ask how you get the log information of flet build windows
?? I cant seem to find any info on it.
Can i ask how you get the log information of
flet build windows
?? I cant seem to find any info on it.
My issue was solved in flet v0.23.2
`import flet as ft
def main(page): def handle_nav_change(e): if e.control.selected_index == 0: page.controls = [] elif e.control.selected_index == 1: page.controls = [ft.Text("Commute!")] elif e.control.selected_index == 2: page.controls = [ft.Text("Notes!")] elif e.control.selected_index == 3: page.controls = [login_field, password_field, login_button] page.update()
login_field = ft.TextField(label = 'Username')
password_field = ft.TextField(label = 'Password', password = True, can_reveal_password=True)
login_button = ft.ElevatedButton(text = "Sign in")
page.title = "Star"
page.navigation_bar = ft.NavigationBar(
on_change=handle_nav_change,
destinations=[
ft.NavigationBarDestination(icon= 'chat_outlined', selected_icon='chat_rounded', label="Chats"),
ft.NavigationBarDestination(icon='explore_outlined', selected_icon='explore_rounded', label="Find"),
ft.NavigationBarDestination(
icon='bookmark_border',
selected_icon='bookmark',
label="Notes",
),
ft.NavigationBarDestination(icon='person_outlined', selected_icon='person_rounded', label="You"),
],
)
page.add(ft.Text('mrak'))
ft.app(target=main) `
hi guys, i have a problem this app doesn't launch after flet build windows, what should i do? help me please
oh, and NavigationBar example from flet.dev also doesn't launch after build
Description
After the last flet update, I tried building my app for both windows and apk, and, to my surprise, they didn't work as expected and I was presented with a blank screen (empty dark grey, to be precise, as I use dark theme in the app). The building process works fine, though, no errors reported and both .exe and .apk files are created.
Running the app from the play button on the IDE (Pycharm), 'flet run' and 'flet run --android' works just fine.
I even tried simplifying my code the most I could and leave just a single screen (Flet View), but nothing works. I have also tried to build other projects i found online and most of them didn't work, even the simplest of them. Some of them did work, but they were just 10 lines of code, a screen with a Text element.
Simplified code to reproduce the issue:
Windows build log (flet build windows):
Results:
As I said, a blank screen:
Expected
A simple welcoming screen:
Flet version (
pip show flet
):Operating system:
Windows 11 Pro, 23H2, 22631.3007