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
9.59k stars 372 forks source link

Trying to run Flet on Android with Chaquopy #213

Closed lijinshanmx closed 1 year ago

lijinshanmx commented 1 year ago

very good library.๐Ÿ‘

FeodorFitsner commented 1 year ago

Why close the issue? :) Have you got any success with running Flet on Android? What was your process?

lijinshanmx commented 1 year ago

Yes, I run it successfully, my idea is to write python code on the phone, and then run it on the phone. Now it is running successfully on android9, but on android12 it prompts me that I do not have permission to run fletd, although I added chmod+x permission to it

lijinshanmx commented 1 year ago

I cross-compiled fletd and reported an error because the content folder is missing, and it cannot be empty. Just place an empty file in it. Then compile the executable file of fletd-arm64-v8a,Then put fletd under cache/tmp/ and set runnable permissions.But it was successful on lower versions of Android, and I haven't found the cause of the problem in higher versions.

FeodorFitsner commented 1 year ago

What program is on the left screenshot?

lijinshanmx commented 1 year ago

https://pub.dev/packages/chaquopy ,I use this pub package to run python programs on the flutter side.

lijinshanmx commented 1 year ago

I think you've got the full idea of โ€‹โ€‹what I'm thinking now๐Ÿ˜„๐Ÿ˜„

FeodorFitsner commented 1 year ago

Ah, nice! It's getting together in my head now :) So, there is a Flutter widget for using Chaquopy SDK! Will take a look - it will help me to figureout the best way to package Flet apps for mobile. Thank you!

lijinshanmx commented 1 year ago

Yes, completely native, no network required. Just run fletd locally. But the current problem is: there is no permission to run fletd on android12. Adding chmod+x doesn't work either. I have time to continue researching this issue. Finally, thanks again for the flet library.๐Ÿ˜๐Ÿ˜

FeodorFitsner commented 1 year ago

So, how did you cross-compiled Fletd for Android? I'm wondering why linux-arm64.tar.gz from here didn't work?

FeodorFitsner commented 1 year ago

Interesting though that flet-linux-arm64.tar.gz Flutter client worked, right? :)

lijinshanmx commented 1 year ago

I execute it on android, Chaquopy prompts: Exec format error. So, it should be that the executable file format is not correct. I cross compile as follows use android ndk version 21:

env:
      - CGO_ENABLED=0 CC=/Users/xxxxx/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android29-clang

goos:
      - android
goarch:
      - arm64

flet-linux-arm64.tar.gz not working.

FeodorFitsner commented 1 year ago

Of course, goos=android!

So, Flet app on your phone is opening in the browser?

lijinshanmx commented 1 year ago

No, I am in the #211 you just submitted, this client can run directly, just specify the port. Both remain the same. They communicate via websockets you wrote [fletd].

FeodorFitsner commented 1 year ago

Smart! ๐Ÿ˜€ Didn't expect someone to notice that FletApp was moved into a separate Flutter package!

lijinshanmx commented 1 year ago

I've been following fletd for two weeks because I just found out about it too. Your idea of โ€‹โ€‹starting is very clever, I've been following your commits and plans lately, haha๐Ÿ˜„๏ผŒthat's great!๐Ÿ‘