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
10.99k stars 426 forks source link

error when build apk with map & geolocator #4065

Open TimurNasirov opened 1 day ago

TimurNasirov commented 1 day ago

Duplicate Check

Describe the bug

I'm putting together a program that receives my coordinates, displays them on the map and prints the location where I am. When I start the build I saw an error in my logs. (when I run the program simply through Python, everything works)

Code sample

Code ```python import flet as ft import flet.map as map async def main(page: ft.Page): gl = ft.Geolocator( location_settings=ft.GeolocatorSettings( accuracy=ft.GeolocatorPositionAccuracy.BEST ), on_error=lambda e: page.add('error') ) page.overlay.append(gl) def know_position(lat, lon): #there is not real values; just an example if lat < 40 and lat > 40 and lon > 72 and lon < 72: return 'Дом быта' elif lat < 40 and lat > 40 and lon > 72 and lon < 72: return 'Бабушка' elif lat < 40 and lat > 72 and lon > 40 and lon < 72: return 'Дедушка' elif lat < 40 and lat > 40 and lon > 72 and lon < 72: return 'Школа' elif lat < 40 and lat > 40 and lon > 72 and lon < 72: return 'Детсад' def locate(e): page.clean() status = gl.get_permission_status() if status != ft.GeolocatorPermissionStatus.ALWAYS and status != ft.GeolocatorPermissionStatus.WHILE_IN_USE: gl.open_location_settings() page.add(ft.Text('reload your app')) pos = gl.get_current_position() page.add( ft.Row( [ map.Map( width=300, height=300, configuration=map.MapConfiguration( initial_center=map.MapLatitudeLongitude(pos.latitude, pos.longitude), initial_zoom=18.5, interaction_configuration=map.MapInteractionConfiguration( flags=map.MapInteractiveFlag.ALL ), on_init=lambda e: print(f"Initialized Map") ), layers=[ map.TileLayer( url_template="https://tile.openstreetmap.org/{z}/{x}/{y}.png", on_image_error=lambda e: print("TileLayer Error"), ), map.MarkerLayer( markers=[ map.Marker( content=ft.Icon(ft.icons.LOCATION_ON, color='red'), coordinates=map.MapLatitudeLongitude(pos.latitude, pos.longitude), ), ], ), ], ), ft.Column( [ ft.Text(f'Location: {pos.latitude}, {pos.longitude}', selectable=True), ft.Text(f'Place: {know_position(pos.latitude, pos.longitude)}'), ft.ElevatedButton('Обновить', on_click=locate) ] ) ] ) ) page.add( ft.OutlinedButton( "Get Current Position", on_click=locate, ) ) ft.app(target=main) ```

To reproduce

  1. enter in terminal "flet build apk --include-packages flet_geolocator flet_map --verbose"
  2. Wait a little
  3. See an error

Expected behavior

I want to see apk file in build directory and message "Successfully builded"

Screenshots / Videos

Captures [Upload media here]

Operating System

Windows

Operating system details

Windows 11

Flet version

0.24.1

Regression

I'm not sure / I don't know

Suggestions

No response

Logs

Logs ```console [02:09:48] Flutter bootstrap directory: C:\Users\HONOR\AppData\Local\Temp\flet_flutter_build_okfSUQiAz5 Additional Flutter dependencies: {'flet_geolocator': 'any', 'flet_map': 'any'} [02:09:51] Created Flutter bootstrap project from gh:flet-dev/flet-build-template with ref 0.24.1 ✅ Copying D:\projects\geosender\assets\icon.png to C:\Users\HONOR\AppData\Local\Temp\flet_flutter_build_okfSUQiAz5\images Customized app icons and splash images ✅ Run subprocess: ['D:\\program\\flutter\\bin\\dart.BAT', 'run', 'flutter_launcher_icons'] (● ) Generating app icons ⏳... The Dart CLI developer tool uses Google Analytics to report usage and diagnostic data along with package dependencies, and crash reporting to send basic crash reports. This data is used to help improve the Dart platform, Flutter framework, and related tools. Telemetry is not sent on the very first run. To disable reporting of telemetry, run this terminal command: dart --disable-analytics If you opt out of telemetry, an opt-out event will be sent, and then no further information will be sent. This data is collected in accordance with the Google Privacy Policy (https://policies.google.com/privacy). ( ● ) Generating app icons (3.4s) Downloading packages... Got dependencies in `C:\Users\HONOR\AppData\Local\Temp\flet_flutter_build_okfSUQiAz5`. ( ● ) Generating app icons (1.3s) Built flutter_launcher_icons:flutter_launcher_icons. ( ● ) Generating app icons ⏳... ════════════════════════════════════════════ FLUTTER LAUNCHER ICONS (v0.13.1) ════════════════════════════════════════════ ( ● ) Generating app icons ⏳... • Creating default icons Android • Overwriting the default Android launcher icon with a new icon ( ● ) Generating app icons ⏳... • Overwriting default iOS launcher icon with new icon (● ) Generating app icons ⏳... Creating Icons for Web... ( ● ) Generating app icons ⏳... Creating Icons for Windows... Creating Icons for MacOS... ( ● ) Generating app icons ⏳... ✓ Successfully generated launcher icons [02:09:57] Generated app icons ✅ Run subprocess: ['D:\\program\\flutter\\bin\\dart.BAT', 'run', 'flutter_native_splash:create'] ( ● ) Generating splash screens (1.4s) Built flutter_native_splash:create. ( ● ) Generating splash screens ⏳... [Android] Creating default splash images ( ● ) Generating splash screens ⏳... [Android] Creating dark mode splash images ( ●) Generating splash screens ⏳... [Android] Creating default android12splash images [Android] Creating dark mode android12splash images ( ● ) Generating splash screens ⏳... [Android] Updating launch background(s) with splash image path... [Android] - android/app/src/main/res/drawable/launch_background.xml ( ● ) Generating splash screens ⏳... [Android] - android/app/src/main/res/drawable-night/launch_background.xml [Android] - android/app/src/main/res/drawable-v21/launch_background.xml [Android] - android/app/src/main/res/drawable-night-v21/launch_background.xml [Android] Updating styles... [Android] - android/app/src/main/res/values-v31/styles.xml [Android] No android/app/src/main/res/values-v31/styles.xml found in your Android project [Android] Creating android/app/src/main/res/values-v31/styles.xml and adding it to your Android project [Android] - android/app/src/main/res/values-night-v31/styles.xml [Android] No android/app/src/main/res/values-night-v31/styles.xml found in your Android project [Android] Creating android/app/src/main/res/values-night-v31/styles.xml and adding it to your Android project [Android] - android/app/src/main/res/values/styles.xml [Android] - android/app/src/main/res/values-night/styles.xml (● ) Generating splash screens ⏳... [iOS] Creating images [iOS] Creating dark mode images [iOS] Updating ios/Runner/Info.plist for status bar hidden/visible ( ● ) Generating splash screens ⏳... [Web] Creating images ( ● ) Generating splash screens ⏳... [Web] Creating images ( ● ) Generating splash screens ⏳... [Web] Creating background images [Web] Creating CSS ( ● ) Generating splash screens ⏳... [Web] Updating index.html ✅ Native splash complete. Now go finish building something awesome! 💪 You rock! 🤘🤩 Like the package? Please give it a 👍 here: https://pub.dev/packages/flutter_native_splash [02:10:00] Generated splash screens ✅ Run subprocess: ['D:\\program\\flutter\\bin\\dart.BAT', 'run', 'serious_python:main', 'package', 'D:\\projects\\geosender', '--mobile', '--platform', 'mobile', '--dep-mappings', 'flet=flet-embed', '--req-deps', 'flet-embed', '--exclude', 'build'] ( ● ) Packaging Python app ⏳... Built serious_python:main. (● ) Packaging Python app ⏳... Running package command Creating asset directory: C:\Users\HONOR\AppData\Local\Temp\flet_flutter_build_okfSUQiAz5\app Copying Python app from D:\projects\geosender to C:\Users\HONOR\AppData\Local\Temp\serious_python_temp692ddb5a ( ● ) Packaging Python app ⏳... Configured mobile platform with sitecustomize.py at C:\Users\HONOR\AppData\Local\Temp\serious_python_sitecustomize72ad70f6\sitecustomize.py Installing dependencies [flet-embed] with pip command to C:\Users\HONOR\AppData\Local\Temp\serious_python_temp692ddb5a\__pypackages__ Extracting Python distributive from C:\Users\HONOR\AppData\Local\Temp\cpython-3.11.6+20231002-x86_64-pc-windows-msvc-shared-install_only.tar.gz to C:\Users\HONOR\AppData\Local\Temp\hostpython3.11_a25b6e09 ( ● ) Packaging Python app ⏳... Compiling Python sources at C:\Users\HONOR\AppData\Local\Temp\serious_python_temp692ddb5a (● ) Packaging Python app ⏳... Delete unnecessary files with extensions: [.py, .c, .h, .typed, .exe, .so, .a, .pdb, .pyd, .dll] Delete unnecessary files and directories: [__pycache__, bin] ( ● ) Packaging Python app ⏳... Creating app archive at C:\Users\HONOR\AppData\Local\Temp\flet_flutter_build_okfSUQiAz5\app/app.zip from C:\Users\HONOR\AppData\Local\Temp\serious_python_temp692ddb5a ( ● ) Packaging Python app ⏳... Deleting temp directory C:\Users\HONOR\AppData\Local\Temp\serious_python_temp692ddb5a ( ● ) Packaging Python app ⏳... Deleting sitecustomize directory C:\Users\HONOR\AppData\Local\Temp\serious_python_sitecustomize72ad70f6 Deleting Python directory C:\Users\HONOR\AppData\Local\Temp\hostpython3.11_a25b6e09 [02:10:55] Packaged Python app ✅ Run subprocess: ['D:\\program\\flutter\\bin\\flutter.BAT', 'build', 'apk'] ( ● ) Building .apk for Android ⏳... ( ● ) Building .apk for Android ⏳... ( ● ) Building .apk for Android ⏳... collection 1.18.0 (1.19.0 available) fl_chart 0.68.0 (0.69.0 available) flutter_launcher_icons 0.13.1 (0.14.1 available) flutter_lints 2.0.3 (5.0.0 available) http_parser 4.0.2 (4.1.0 available) js 0.6.7 (0.7.1 available) lints 2.1.1 (5.1.0 available) material_color_utilities 0.8.0 (0.12.0 available) meta 1.12.0 (1.16.0 available) ! package_info_plus 8.0.2 (overridden) screen_retriever 0.1.9 (0.2.0 available) sensors_plus 4.0.2 (6.0.1 available) sensors_plus_platform_interface 1.2.0 (2.0.0 available) toml 0.15.0 (0.16.0 available) url_launcher_android 6.3.9 (6.3.10 available) url_strategy 0.2.0 (0.3.0 available) ! wakelock_plus 1.2.8 (overridden) ! web 1.1.0 (overridden) web_socket_channel 2.4.5 (3.0.1 available) window_manager 0.3.9 (0.4.2 available) Got dependencies! 17 packages have newer versions incompatible with dependency constraints. Try `flutter pub outdated` for more information. ( ● ) Building .apk for Android ⏳... ../../Pub/Cache/hosted/pub.dev/flet-0.24.1/lib/src/utils/theme.dart:296:5: Error: No named parameter with the name 'headingRowAlignment'. headingRowAlignment: parseMainAxisAlignment(j["heading_row_alignment"]), ^^^^^^^^^^^^^^^^^^^ ../../Pub/Cache/hosted/pub.dev/flet-0.24.1/lib/src/controls/datatable.dart:122:17: Error: No named parameter with the name 'headingRowAlignment'. headingRowAlignment: parseMainAxisAlignment( ^^^^^^^^^^^^^^^^^^^ /D:/program/flutter/packages/flutter/lib/src/material/data_table.dart:39:9: Context: Found this candidate, but the arguments don't match. const DataColumn({ ^^^^^^^^^^ ../../Pub/Cache/hosted/pub.dev/flet-0.24.1/lib/src/controls/datatable.dart:135:14: Error: The argument type 'List' can't be assigned to the parameter type 'List'. - 'List' is from 'dart:core'. - 'DataColumn' is from 'package:flutter/src/material/data_table.dart' ('/D:/program/flutter/packages/flutter/lib/src/material/data_table.dart'). }).toList(), ^ ../../Pub/Cache/hosted/pub.dev/flet-0.24.1/lib/src/controls/expansion_tile.dart:105:7: Error: No named parameter with the name 'showTrailingIcon'. showTrailingIcon: control.attrBool("showTrailingIcon", true)!, ^^^^^^^^^^^^^^^^ /D:/program/flutter/packages/flutter/lib/src/material/expansion_tile.dart:230:9: Context: Found this candidate, but the arguments don't match. const ExpansionTile({ ^^^^^^^^^^^^^ ../../Pub/Cache/hosted/pub.dev/flet-0.24.1/lib/src/controls/menu_item_button.dart:91:7: Error: No named parameter with the name 'semanticsLabel'. semanticsLabel: widget.control.attrString("semanticsLabel"), ^^^^^^^^^^^^^^ /D:/program/flutter/packages/flutter/lib/src/material/menu_anchor.dart:843:9: Context: Found this candidate, but the arguments don't match. const MenuItemButton({ ^^^^^^^^^^^^^^ Target kernel_snapshot failed: Exception FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:compileFlutterBuildRelease'. > Process 'command 'D:\program\flutter\bin\flutter.bat'' finished with non-zero exit value 1 * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. BUILD FAILED in 15s ( ● ) Building .apk for Androi 15,7s Gradle task assembleRelease failed with exit code 1 [02:11:13] Deleting Flutter bootstrap directory C:\Users\HONOR\AppData\Local\Temp\flet_flutter_build_okfSUQiAz5 Error building Flet app - see the log of failed command above. Run subprocess: ['D:\\program\\flutter\\bin\\flutter.BAT', '--version'] [02:11:14] Run subprocess: ['D:\\program\\flutter\\bin\\flutter.BAT', 'doctor'] [02:11:16] Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel stable, 3.22.2, on Microsoft Windows [Version 10.0.22631.4169], locale ru-RU) [√] Windows Version (Installed version of Windows is version 10 or higher) [!] Android toolchain - develop for Android devices (Android SDK version 35.0.0) X cmdline-tools component is missing Run `path/to/sdkmanager --install "cmdline-tools;latest"` See https://developer.android.com/studio/command-line for more details. X Android license status unknown. Run `flutter doctor --android-licenses` to accept the SDK licenses. See https://flutter.dev/docs/get-started/install/windows#android-setup for more details. [√] Chrome - develop for the web [X] Visual Studio - develop Windows apps X Visual Studio not installed; this is necessary to develop Windows apps. Download at https://visualstudio.microsoft.com/downloads/. Please install the "Desktop development with C++" workload, including all of its default components [√] Android Studio (version 2024.1) [√] Connected device (3 available) [√] Network resources ! Doctor found issues in 2 categories. ```

Additional details

No response

ndonkoHenri commented 2 hours ago

Upgrade your Flutter version to 3.24.0 at least and retry.