flet-dev / flet

Flet enables developers to easily build realtime web, mobile and desktop apps in Python. No frontend experience required.
https://flet.dev
Apache License 2.0
11.16k stars 429 forks source link

Blank screen in Flet App When Packed into APK #2830

Closed hazik-khalid closed 7 months ago

hazik-khalid commented 7 months ago

Description: When running my Python GUI framework, Flet, in web view or normal window mode, the app displays correctly However, after packing it into an APK using the provided GitHub workflow and .yml file, the app exhibits a light-black gray color instead. No errors occur during the build process.

Expected Behavior: The app's appearance should remain consistent whether running in web or normal window with the apk version

Additional Information:

Flet version: 0.21.1 (also tested on 0.20.0)
Flutter version: 3.16.8
Python version: 3.11.6

Workflow .yml File:

name: Python and Flutter Build

on: push: branches:

jobs: build: runs-on: ubuntu-latest

steps:
- name: Checkout code
  uses: actions/checkout@v2

- name: Set up Python 3.11.6
  uses: actions/setup-python@v2
  with:
    python-version: 3.11.6

- name: Install dependencies
  run: |
    python -m pip install --upgrade pip
    pip install -r requirements.txt

- name: Set up Android SDK
  uses: android-actions/setup-android@v2

- name: Set up Flutter
  uses: subosito/flutter-action@v2
  with:
    flutter-version: '3.16.8' # La versión de Flutter que estás utilizando

- name: Build with Flet
  run: |
    flet build apk --template https://github.com/KeimaSenpai/Flet-template-build.git

- name: Create Release
  id: create_release
  uses: actions/create-release@v1
  env:
    GITHUB_TOKEN:  ${{ secrets.token}}
  with:
    tag_name: v1.0.1
    release_name: Release 1.0.1
    body: |
      This is the first release.
    draft: false
    prerelease: false
- name: Upload Release Asset
  id: upload-release-asset
  uses: actions/upload-release-asset@v1
  env:
    GITHUB_TOKEN: ${{ secrets.token}}
  with:
    upload_url: ${{ steps.create_release.outputs.upload_url }}
    asset_path: ./build/apk/app-release.apk
    asset_name: app-release.apk
    asset_content_type: application/zip
jaluscg commented 7 months ago

A mi también me sucedía esto. Intenté de varias maneras y la única que me sirvió fue usando en el .yml el servidor de macos en vez del de Ubuntu asi:

build-android: runs-on: macos-latest

steps:
- uses: actions/checkout@v3

- name: Set up JDK 18
  uses: actions/setup-java@v3
  with:
    java-version: '18'
    distribution: 'temurin' # Eclipse Adoptium

- name: Install Android Command Line Tools
  run: |
    brew install --cask android-commandlinetools

- name: Accept Licenses
  run: yes | sdkmanager --licenses

- name: Install Android SDK and Tools
  run: |
    sdkmanager "cmdline-tools;latest" "platforms;android-33" "emulator" "tools" "platform-tools" "ndk;25.2.9519653"

- name: Install Python and Flet
  run: |
    pip3 install flet
    pip3 install git+https://github.com/flet-dev/python-for-android.git@3.11.6
    pip3 install --upgrade cython

- name: Set up p4a
  run: |
    export ANDROID_SDK_ROOT="/Users/runner/Library/Android/sdk"
    export NDK_VERSION=25.2.9519653
    export SDK_VERSION=android-33
    ( echo "Y"; while true; do echo "N"; done ) | p4a create --requirements python3 --arch arm64-v8a --arch armeabi-v7a --arch x86_64 --sdk-dir $ANDROID_SDK_ROOT --ndk-dir $ANDROID_SDK_ROOT/ndk/$NDK_VERSION --dist-name mydist
    export SERIOUS_PYTHON_P4A_DIST=$HOME/.python-for-android/dists/mydist

- name: Set up Flutter
  uses: subosito/flutter-action@v2
  with:
    channel: 'stable'

- name: Build APK
  run: flet build apk -vv

- name: Archive APK
  run: |
    zip -r (el nombre de tu app)-android.zip ./build/apk/*.apk

- name: Upload APK to GitHub Release
  run: |
    gh release upload ${{ github.event.release.tag_name }} (el nombre de tu app)-android.zip
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ixenion commented 4 months ago

No activity here, cool... Have the same problem - blank screen

ixenion commented 4 months ago

Does anyone EVER succeded with apk build on ubuntu??

hazik-khalid commented 4 months ago

Na i wasted god know how many days at last shifted to react native