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

`flet build` command to package Flet app for any platform #2271

Closed FeodorFitsner closed 5 months ago

FeodorFitsner commented 5 months ago

Documentation: https://flet.dev/docs/guides/python/packaging-app-for-distribution

jianboy commented 5 months ago

add a command to create project, such as:

flet create --template flet-build-template

it likes flutter create command:

flutter create --offline --ios-language swift --android-language java --org io.github.jianboy.flutter --project-name xx .
baseplate-admin commented 5 months ago

hi @FeodorFitsner, could you please release this ?

I been waiting so long to try this

FeodorFitsner commented 5 months ago

Will release it tomorrow. For now you can install pre-release: https://pypi.org/project/flet/0.18.0.dev2027/

FeodorFitsner commented 5 months ago

Pre-release docs: https://flet-build-docs.flet-website.pages.dev/docs/guides/python/packaging-app-for-distribution

baseplate-admin commented 5 months ago

Thanks a bunch

baseplate-admin commented 5 months ago
PS C:\Programming\Finstagram-main> poetry run flet build apk
Creating Flutter bootstrap project...OK
Customizing app icons and splash images...OK
Generating app icons...Exception in thread Thread-1 (_readerthread):
Traceback (most recent call last):
  File "C:\Users\baseplate-admin\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "C:\Users\baseplate-admin\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1010, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\baseplate-admin\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 1597, in _readerthread
    buffer.append(fh.read())
                  ^^^^^^^^^
  File "C:\Users\baseplate-admin\AppData\Local\Programs\Python\Python312\Lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 4: character maps to <undefined>
OK
Generating splash screens...Exception in thread Thread-3 (_readerthread):
Traceback (most recent call last):
  File "C:\Users\baseplate-admin\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "C:\Users\baseplate-admin\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1010, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\baseplate-admin\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 1597, in _readerthread
    buffer.append(fh.read())
                  ^^^^^^^^^
  File "C:\Users\baseplate-admin\AppData\Local\Programs\Python\Python312\Lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 1471: character maps to <undefined>
OK
Packaging Python app...OK
Building .apk for Android...

Please do note that i encountered this error while compiling apk

baseplate-admin commented 5 months ago

Screenshot_20231230_113846

After compiling i got this screen.

Compared to PC version

image

Device : Samsung A54 APK : https://send.vis.ee/download/e67eaa253c260476/#WmbfFW51YuW0oz_epfJU0g Github repo : https://github.com/tokitou-san/Finstagram/

ipcloudlive commented 5 months ago

For me

(.venv) PS C:\Users\PRO\Desktop\testpackage> flet build apk
Creating Flutter bootstrap project...OK
Customizing app icons and splash images...OK
Generating app icons...Exception in thread Thread-1 (_readerthread):
Traceback (most recent call last):
  File "C:\Python312\Lib\threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "C:\Python312\Lib\threading.py", line 1010, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Python312\Lib\subprocess.py", line 1597, in _readerthread
    buffer.append(fh.read())
                  ^^^^^^^^^
  File "C:\Python312\Lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 4: character maps to <undefined>
OK
Generating splash screens...Exception in thread Thread-3 (_readerthread):
Traceback (most recent call last):
  File "C:\Python312\Lib\threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "C:\Python312\Lib\threading.py", line 1010, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Python312\Lib\subprocess.py", line 1597, in _readerthread
    buffer.append(fh.read())
                  ^^^^^^^^^
  File "C:\Python312\Lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 1471: character maps to <undefined>
OK
Packaging Python app...OK
Building .apk for Android...Resolving dependencies...
  fl_chart 0.65.0 (0.66.0 available)
  flutter_lints 2.0.3 (3.0.1 available)
  flutter_native_splash 2.3.7 (2.3.8 available)
  lints 2.1.1 (3.0.0 available)
  matcher 0.12.16 (0.12.16+1 available)
  material_color_utilities 0.5.0 (0.8.0 available)
  meta 1.10.0 (1.11.0 available)
  package_info_plus 4.2.0 (5.0.1 available)
  path 1.8.3 (1.9.0 available)
  petitparser 5.4.0 (6.0.2 available)
  sensors_plus 1.4.1 (4.0.2 available)
  test_api 0.6.1 (0.7.0 available)
  toml 0.14.0 (0.15.0 available)
  uuid 4.2.2 (4.3.1 available)
  web 0.3.0 (0.4.0 available)
  web_socket_channel 2.4.0 (2.4.1 available)
  xml 6.3.0 (6.5.0 available)
Got dependencies!
17 packages have newer versions incompatible with dependency constraints.
Try `flutter pub outdated` for more information.

Building with plugins requires symlink support.

Please enable Developer Mode in your system settings. Run
  start ms-settings:developers
to open settings.

Error building Flet app - see the log of failed command above.
baseplate-admin commented 5 months ago

@ipcloudlive https://stackoverflow.com/questions/68089177/flutter-building-with-plugins-requires-symlink-support

FeodorFitsner commented 5 months ago

@baseplate-admin what is the name of the file with your Flet app? If it's not main.py then use --module-name option to specify alternative entry-point.

FeodorFitsner commented 5 months ago

Fix for "charmap" error on Windows is coming!

baseplate-admin commented 5 months ago

@baseplate-admin what is the name of the file with your Flet app? If it's not main.py then use --module-name option to specify alternative entry-point.

It is main.py. flet also packages all corresponding python apps

FeodorFitsner commented 5 months ago

@baseplate-admin OK. Please start a new issue and provide a full build log with flet build apk -vv. We'll continue there.