flet icon indicating copy to clipboard operation
flet copied to clipboard

flet build apk (Error building Flet app )

Open Legolaz7 opened this issue 8 months ago • 21 comments

Duplicate Check

  • [X] I have searched the opened issues and there are no duplicates

Describe the bug

Yesterday everything worked, but today an error appears. I enter the command flet build apk and then an error appears

(.venv) PS C:\Users\Admin\PycharmProjects\pythonProject> flet build apk
Creating Flutter bootstrap project from gh:flet-dev/flet-build-template with ref 0.22.1...OK
Customizing app icons and splash images...OK
Generating app icons...OK
Generating splash screens...OK
Packaging Python app...Running package command
Creating asset directory: C:\Users\Admin\AppData\Local\Temp\flet_flutter_build_HOYh5lBMSR\app
Copying Python app from C:\Users\Admin\PycharmProjects\pythonProject to C:\Users\Admin\AppData\Local\Temp\serious_python_temp45145dc9
Configured mobile platform with sitecustomize.py at C:\Users\Admin\AppData\Local\Temp\serious_python_sitecustomize526188c\sitecustomize.py
Installing dependencies  with pip command to C:\Users\Admin\AppData\Local\Temp\serious_python_temp45145dc9\__pypackages__
Extracting Python distributive from C:\Users\Admin\AppData\Local\Temp\cpython-3.11.6+20231002-x86_64-pc-windows-msvc-shared-install_only.tar.gz to C:\Users\Admin\AppData\Local\Temp\hostpython3.11_6782aa81
Compiling Python sources at C:\Users\Admin\AppData\Local\Temp\serious_python_temp45145dc9

Error building Flet app - see the log of failed command above.

Code

from flet import *

def main(page: Page):
    page.title = "Test Page"
    page.window_width = 430.00
    page.window_height = 830.00

    # Function to remove panel
    def handle_delete(e: ControlEvent):
        panel.controls.remove(e.control.data)
        page.update()

    # The function changes the name of the saved data
    def edit(e: ControlEvent):
        pass

    def save_info(e: ControlEvent):
        text = ExpansionPanel(
            header=ListTile(title=Text(f"{start_text.value}")),
            can_tap_header=False
        )
        text.content = ListTile(
            subtitle=Text(f"{start_text.value}"),
            trailing=PopupMenuButton(
                icon=icons.MORE_VERT,
                items=[
                    PopupMenuItem('Delete', on_click=handle_delete, data=text),
                    PopupMenuItem('Change name', on_click=open_dlg_edit, data=text),
                ]
            )
        )
        panel.controls.append(text)
        page.update()

    def open_dlg_edit(e):
        page.dialog = dlg
        dlg.open = True
        page.update()
        dlg.open = False

    # Closes the dialog box after clearing the input field
    def close_dlg(e):
        edit_text.value = ""
        dlg.open = False
        page.update()


    panel = ExpansionPanelList(
        expand_icon_color=colors.AMBER,
        elevation=8,
        divider_color=colors.AMBER
    )

    start_text = TextField(label='Start text')
    edit_text = TextField(label='New name')
    save_b = OutlinedButton('Save', on_click=save_info)
    saves = Container(
        Column(
            controls=[
                panel
            ]
        ), width=380, height=300, border_radius=15, padding=10
    )

    dlg = AlertDialog(
        title=Text("Change the name?"),
        modal=True,
        actions=[
            Column(
                controls=[
                    edit_text,
                    Row(
                        controls=[
                            TextButton('Cancel', on_click=close_dlg),
                            TextButton('Save', on_click=edit)
                        ], alignment=MainAxisAlignment.END
                    )
                ]
            )

        ]
    )

    page.add(Column(
        controls=[
            saves,
            start_text,
            save_b
        ]
    ))
    
app(target=main)

To reproduce

flet build windows gives the same error

Expected behavior

No response

Screenshots

1

Operating System

Windows

Operating system details

Windows 10 x64

Flet version

(.venv) PS C:\Users\Admin\PycharmProjects\pythonProject> pip show flet Name: flet Version: 0.22.1 Summary: Flet for Python - easily build interactive multi-platform apps in Python Home-page: Author: Appveyor Systems Inc. Author-email: [email protected] License: Apache-2.0 Location: C:\Users\Admin\PycharmProjects\pythonProject.venv\Lib\site-packages Requires: cookiecutter, fastapi, flet-runtime, packaging, qrcode, uvicorn, watchdog Required-by:

Regression

No, it isn't

Suggestions

I have always compiled the apk file this way. Never used the requirements.txt file

Next I decided to add the requirements.txt file, I entered there: flet == 0.22.1 Next comes compilation, and it is endless:

(.venv) PS C:\Users\Admin\PycharmProjects\pythonProject> flet build apk
Creating Flutter bootstrap project from gh:flet-dev/flet-build-template with ref 0.22.1...OK
Customizing app icons and splash images...OK
Generating app icons...OK
Generating splash screens...OK
Packaging Python app...

I also tried adding complete data to requirements.txt but it didn’t help, the compilation went on, but it didn’t finish

Additional details

No response

Legolaz7 avatar Jun 16 '24 20:06 Legolaz7