flet icon indicating copy to clipboard operation
flet copied to clipboard

Issues with the Flet Mobile App SDK 0.21.1

Open MaxXilon opened this issue 11 months ago • 9 comments

Description

After updating flet to version 0.21.1

  • Connection to the flet mobile app results in errors

  • Doesn't display image in web

Describe the results you received:

  • Connection error in flet Mobile app:

https://github.com/flet-dev/flet/assets/156061407/1aca8e85-7cdc-49b5-8cae-e45ee63f5d75

  • No image displayed:

Screenshot_20240307-112603.png

Describe the results you expected:

  • Successfully Connection.

  • Image displayed.

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

flet run <appName>.py --android -r -v 

Or

flet run <appName>.py --web -r -v
  • No logs during app startup process.

  • When change made is in <appName>.py, the app is page stuck at spinning progress ring, instead of displaying changes.

https://github.com/flet-dev/flet/assets/156061407/de3f4d1b-a67d-4b50-a5cb-cc7bd76531c3

Flet version (pip show flet):

Version: 0.21.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: /usr/local/lib/python3.10/dist-packages
Requires: cookiecutter, fastapi, flet-runtime, packaging, qrcode, uvicorn, watchdog
Required-by:

Operating system:

  • Command being run on Linux.

  • Testing on Android.

  • Linux version:

PRETTY_NAME="Ubuntu 22.04.4 LTS" NAME="Ubuntu" VERSION_ID="22.04" VERSION="22.04.4 LTS (Jammy Jellyfish)" VERSION_CODENAME=jammy ID=ubuntu ID_LIKE=debian HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" UBUNTU_CODENAME=jammy

  • Android version:

8.1.0

Web browsers tested on:

  • Chrome
  • OperaMini
  • via (Android only)

MaxXilon avatar Mar 07 '24 11:03 MaxXilon

Do you have a repro code for image issue?

FeodorFitsner avatar Mar 07 '24 17:03 FeodorFitsner

Same problem here - but with the most basic app : flet create my-app

flet run --android
App is running on: http://192.168.1.37:8551/my-app/main.py

Both phone and laptop on the same wifi, same local network.

Yet, I get the error message "Error connecting to a Flet service in a timely manner."

WhatsApp Image 2024-03-07 at 18 12 50

If, from the phone, I use the browser, then it works fine. So networking between the phone and the laptop is working fine. For some reason, from the Flet app loader, it is not working.

yashasolutions avatar Mar 07 '24 17:03 yashasolutions

Sorry guys, Flet app should be re-published to both stores! Working on that.

FeodorFitsner avatar Mar 07 '24 17:03 FeodorFitsner

Do you have a repro code for image issue?

Here's a sample code:

import flet as ft

imgsrc='./assets/deaf918056f442f1be15fadf7553cd63.png'


def main(page):
  imgObj=ft.Image(src=imgsrc)
  img = ft.Container(content=ft.Row([imgObj,ft.Text('Image'),]), bgcolor="orange")
  page.add(img)

ft.app(main) 

It only displays the text and container

Screenshot_20240307-220033.png

MaxXilon avatar Mar 07 '24 21:03 MaxXilon

@MaxXilon can you trying specifying the assets dir: https://flet.dev/docs/controls/image/#src

ndonkoHenri avatar Mar 08 '24 08:03 ndonkoHenri

@MaxXilon can you trying specifying the assets dir: https://flet.dev/docs/controls/image/#src

I specified the assets dir here:

import flet as ft

imgsrc='./assets/deaf918056f442f1be15fadf7553cd63.png'
imgsrc2='./deaf918056f442f1be15fadf7553cd63.png'
imgsrc3='/deaf918056f442f1be15fadf7553cd63.png'
imgsrc4='deaf918056f442f1be15fadf7553cd63.png'


def main(page):
  imgObj=ft.Image(src=imgsrc)
  imgObj2=ft.Image(src=imgsrc2)
  imgObj3=ft.Image(src=imgsrc3)
  imgObj4=ft.Image(src=imgsrc4)
  img = ft.Container(content=ft.Column([imgObj,imgObj2,imgObj3,imgObj4,ft.Tex>
  page.add(img)

ft.app(main,assets_dir="assets")

But still no image displayed:

Screenshot_20240308-114945.png

MaxXilon avatar Mar 08 '24 10:03 MaxXilon

i am also experiencing this issue on 0.21.1where Images are not being shown from the assets folder when trying to run project in either webview or with export_asgi.

This was working correctly before and correctly shows the images as expected if running as a non webview app

kiebak3r avatar Mar 11 '24 08:03 kiebak3r

@MaxXilon the Flet mobile app has been updated. Can you update, retry and report?

ndonkoHenri avatar Mar 11 '24 10:03 ndonkoHenri

@MaxXilon the Flet mobile app has been updated. Can you update, retry and report?

I just tested the updated app.

Connection

  • Connection works 😊. Screenshot_20240311-135325.png

Screenshot_20240311-135336.png

Image

  • image display but only if absolute path is defined or using src= f'{os.getcwd()}/assets/<img_name>.png'
import flet as ft
import os

# this works
imgsrc=f'{os.getcwd()}/assets/deaf918056f442f1be15fadf7553cd63.png'
##

# these don't work 
imgsrc2='assets/deaf918056f442f1be15fadf7553cd63.png'

imgsrc3='./assets/deaf918056f442f1be15fadf7553cd63.png'

imgsrc4='deaf918056f442f1be15fadf7553cd63.png'
##


# this works
imgsrc5='/storage/8AA2-0810/Learn/flets/Tests/dynamicApp/assets/deaf918056f442f1be15fadf7553cd63.png'
##


def main(page):
  imgObj=ft.Image(src=imgsrc)

  imgObj2=ft.Image(src=imgsrc2)

  imgObj3=ft.Image(src=imgsrc3)

  imgObj4=ft.Image(src=imgsrc4)

  imgObj5=ft.Image(src=imgsrc5)

  img = ft.Container(content=ft.Column([imgObj,imgObj2,imgObj3,imgObj4,imgObj5,ft.Text('Image'),]), bgcolor="orange",scale=ft.Scale(0.5))

  page.add(img)

ft.app(main,assets_dir="assets") 

Only two images displayed:

Screenshot_20240311-135336.png

Hot reload

  • hot reload is still having issues.

After changes are made to the script this happens:

https://github.com/flet-dev/flet/assets/156061407/fdb7d35d-8d37-4ea6-b4be-210da919f7df

Thanks for the update!

MaxXilon avatar Mar 11 '24 13:03 MaxXilon