Skip to content

FilePicker.save_file() opens blank gray screen in APK build (works fine in VS) #5301

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kamaciki opened this issue May 12, 2025 · 0 comments
Closed
Assignees
Labels
bug Something isn't working
Milestone

Comments

@kamaciki
Copy link

kamaciki commented May 12, 2025

I’m using Flet v0.28.2 to build a simple file picker UI. In Visual Studio debugging everything works as expected, including the “Save” button. However, when I compile the app to APK and install it on an Android device, tapping the “Save” button causes a blank gray screen to open instead of showing the save dialog. The “Pick” and “Get Dir” buttons both work correctly in the APK build.

Reproduction steps:

Create a new Flet app with the following code:

import flet as ft

def main(page: ft.Page):
    page.theme_mode = "light"

    def result(e):
        page.add(ft.Text("result :)"))

    my_dialog = ft.FilePicker(on_result=result)

    page.overlay.append(my_dialog)

    page.add(
        ft.Row([
            ft.ElevatedButton("Pick", icon=ft.Icons.UPLOAD_FILE,
                              on_click=lambda _: my_dialog.pick_files()),
            ft.ElevatedButton("Save", icon=ft.Icons.UPLOAD_FILE,
                              on_click=lambda _: my_dialog.save_file()),
            ft.ElevatedButton("Get Dir", icon=ft.Icons.UPLOAD_FILE,
                              on_click=lambda _: my_dialog.get_directory_path()),
        ])
    )

ft.app(target=main)

Run the app in Visual Studio (debug or “Run”) – all three buttons (pick_files(), save_file(), get_directory_path()) open their respective dialogs correctly.

Build an APK (flet pack apk or equivalent) and install it on an Android device.

Launch the app on the device and tap Save.

Actual behavior:

Visual Studio (desktop/web): “Save” opens the native file-save dialog as expected.

APK on Android: Tapping Save results in a full-screen blank gray overlay. No file dialog appears, and no error is logged.

Expected behavior:

The file-save dialog (native or Flet-provided) should appear on Android, allowing the user to choose a location and enter a filename, then trigger the on_result callback.

Environment:

Flet version: 0.28.2

Python version: 3.13

Build tool: flet build apk

Development OS: Windows 11

Additional information:

The “Pick” (pick_files()) and “Get Dir” (get_directory_path()) functions work without issue in the APK build.

No errors or warnings appear in adb logcat when tapping Save.

Other dialog types (e.g., AlertDialog) do work in the APK build.

Request:

Could this be a limitation or bug in the Android file-save integration? Any pointers on how to diagnose or work around this behavior in the APK? Thanks!

@FeodorFitsner FeodorFitsner self-assigned this May 14, 2025
@FeodorFitsner FeodorFitsner added the bug Something isn't working label May 14, 2025
@FeodorFitsner FeodorFitsner added this to the Flet v0.28.3 milestone May 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants