Skip to content

Blank screen when including python-for-android packages #2428

Closed
@epenguins

Description

@epenguins

Description

First, thank you so much for all the hard work put into Flet! I've been waiting for a long time for the ability to build APKs. I've used Flet for several projects and it is by far my favorite "front end".

I've been able to sucessfully build several APKs using pure Python modules, everything works well there. When I build modules using pytyhon-for-android, the app starts, but shows the dreaded blank screen. I'm using the hello world example, and have not called any of the built modules. The blank screen happens regardless of importing a built module.

I have followed the directions [here](serious_python | Flutter Package) and sucessfully built the dist to be included with flet build apk (trying to include cryptography and bz2). There is some path error on my system when bundle.sh tries to zip _python_bundle_ and move it to ../../libs/{arch}. I manually zipped and moved for each architecture, minor inconvenience, but works. After setting the SERIOUS_PYTHON_P4A_DISTenv variable, flet build apk runs and builds the APK. After installation, the app just shows a blank screen.

I have attached the relavent log files.

Again, thank you for all the work put into Flet!

Code example to reproduce the issue:

import flet as ft
##import bz2

def main(page: ft.Page):
    page.add((ft.Text("Hello, Flet!")))
    # Extra lines for more visibility on mobile screens.
    page.add((ft.Text("Hello, Flet!")))
    page.add((ft.Text("Hello, Flet!")))
    page.add((ft.Text("Hello, Flet!")))
    page.add((ft.Text("Hello, Flet!")))
    page.add((ft.Text("Hello, Flet!")))
    page.add((ft.Text("Hello, Flet!")))


ft.app(main)

Describe the results you received:

The dreaded blank screen.

Describe the results you expected:

Hello, Flet! to be repeated on screen.

Additional information you deem important (e.g. issue happens only occasionally):

ADB debug indicates that libpython3.11.so is not found. I noticed that libpython3.11.so is present in /lib of unzipped APK with out python-for-android dist. libpython3.11.so is not present in /lib when python-for-android dist is included with flet build apk. I copied libpython3.11.so from an extracted APK without python-for-android dist, into the appropriate architectures of /lib so it will be included when flet build apk runs, which seems to have solved that issue.

Now the error is [FATAL:flutter/fml/thread_local.cc(32)] Check failed: false. pthread_setspecific failed (22): Invalid argument

Flet version (pip show flet):

Name: flet
Version: 0.19.0
Summary: Flet for Python - easily build interactive multi-platform apps in Python
Home-page: 
Author: Appveyor Systems Inc.
Author-email: hello@flet.dev
License: Apache-2.0

Operating system:

Debian 12

Additional environment details:

Python 3.11 in venv

Log files:

flet_build_apk.txt
flet-pre-pyhton-for-android.txt
flet-after-python-for-android.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions