Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in new version 0.20.0 when creating apk in Windows 10 #2660

Closed
SebastianSosa opened this issue Feb 17, 2024 · 6 comments
Closed

Error in new version 0.20.0 when creating apk in Windows 10 #2660

SebastianSosa opened this issue Feb 17, 2024 · 6 comments

Comments

@SebastianSosa
Copy link

SebastianSosa commented Feb 17, 2024

Description
In flet 0.20, I encountered an error when creating the APK file, whereas in flet 0.19, the APK was successfully built. However, upon running the APK, another error occurred.

App is correctly working on Windows.

Error Log for flet 0.20-----------------------------------------------------------------------
Creating Flutter bootstrap project...OK
Customizing app icons and splash images...OK
Generating app icons...OK
Generating splash screens...OK
Packaging Python app...OK
Building .apk for Android...Resolving dependencies...
ffi 2.1.0 (2.1.2 available)
fl_chart 0.65.0 (0.66.2 available)
flutter_lints 2.0.3 (3.0.1 available)
flutter_native_splash 2.3.7 (2.3.11 available)
http 1.2.0 (1.2.1 available)
js 0.6.7 (0.7.1 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.12.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)
test_api 0.6.1 (0.7.0 available)
toml 0.14.0 (0.15.0 available)
web 0.3.0 (0.5.0 available)
web_socket_channel 2.4.0 (2.4.4 available)
xml 6.3.0 (6.5.0 available)
Got dependencies!
18 packages have newer versions incompatible with dependency constraints.
Try flutter pub outdated for more information.

Running Gradle task 'assembleRelease'...
Warning: The plugin url_launcher_android requires Android SDK version 34.
For more information about build configuration, see https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
Running Gradle task 'assembleRelease'... 65,6s

One or more plugins require a higher Android SDK version.
Fix this issue by adding the following to C:\Users\SSosa\AppData\Local\Temp\flet_flutter_build_EwbtIwDTyO\android\app\build.gradle:
android {
compileSdkVersion 34
...
}

C:\Users\SSosa\AppData\Local\Android\sdk\ndk\23.1.7779620\toolchains\llvm\prebuilt\windows-x86_64\bin\llvm-strip.exe: error: 'C:\Users\SSosa\AppData\Local\Temp\flet_flutter_build_EwbtIwDTyO\build\serious_python_android\intermediates\merged_native_libs\release\out\lib\armeabi-v7a\libpythonbundle.so': The file was not
recognized as a valid object file

C:\Users\SSosa\AppData\Local\Android\sdk\ndk\23.1.7779620\toolchains\llvm\prebuilt\windows-x86_64\bin\llvm-strip.exe: error: 'C:\Users\SSosa\AppData\Local\Temp\flet_flutter_build_EwbtIwDTyO\build\serious_python_android\intermediates\merged_native_libs\release\out\lib\arm64-v8a\libpythonbundle.so': The file was not recognized
as a valid object file

C:\Users\SSosa\AppData\Local\Android\sdk\ndk\23.1.7779620\toolchains\llvm\prebuilt\windows-x86_64\bin\llvm-strip.exe: error: 'C:\Users\SSosa\AppData\Local\Temp\flet_flutter_build_EwbtIwDTyO\build\serious_python_android\intermediates\merged_native_libs\release\out\lib\x86_64\libpythonbundle.so': The file was not recognized as
a valid object file

../../Pub/Cache/hosted/pub.dev/flet-0.20.1/lib/src/utils/text.dart:156:8: Error: 'FontVariation' isn't a type.
List? variations;
^^^^^^^^^^^^^
../../Pub/Cache/hosted/pub.dev/flet-0.20.1/lib/src/utils/text.dart:158:19: Error: Method not found: 'FontVariation'.
variations = [FontVariation('wght', parseDouble(fontWeight.substring(1)))];
^^^^^^^^^^^^^
../../Pub/Cache/hosted/pub.dev/flet-0.20.1/lib/src/controls/cupertino_textfield.dart:54:40: Error: The getter 'isShiftPressed' isn't defined for the class 'HardwareKeyboard'.

  • 'HardwareKeyboard' is from 'package:flutter/src/services/hardware_keyboard.dart' ('/C:/flutter/packages/flutter/lib/src/services/hardware_keyboard.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'isShiftPressed'.
    if (!HardwareKeyboard.instance.isShiftPressed &&
    ^^^^^^^^^^^^^^
    ../../Pub/Cache/hosted/pub.dev/flet-0.20.1/lib/src/controls/page.dart:219:61: Error: The getter 'isAltPressed' isn't defined for the class 'HardwareKeyboard'.
  • 'HardwareKeyboard' is from 'package:flutter/src/services/hardware_keyboard.dart' ('/C:/flutter/packages/flutter/lib/src/services/hardware_keyboard.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'isAltPressed'.
    isAltPressed: HardwareKeyboard.instance.isAltPressed,
    ^^^^^^^^^^^^
    ../../Pub/Cache/hosted/pub.dev/flet-0.20.1/lib/src/controls/page.dart:221:51: Error: The getter 'isControlPressed' isn't defined for the class 'HardwareKeyboard'.
  • 'HardwareKeyboard' is from 'package:flutter/src/services/hardware_keyboard.dart' ('/C:/flutter/packages/flutter/lib/src/services/hardware_keyboard.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'isControlPressed'.
    HardwareKeyboard.instance.isControlPressed,
    ^^^^^^^^^^^^^^^^
    ../../Pub/Cache/hosted/pub.dev/flet-0.20.1/lib/src/controls/page.dart:222:63: Error: The getter 'isShiftPressed' isn't defined for the class 'HardwareKeyboard'.
  • 'HardwareKeyboard' is from 'package:flutter/src/services/hardware_keyboard.dart' ('/C:/flutter/packages/flutter/lib/src/services/hardware_keyboard.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'isShiftPressed'.
    isShiftPressed: HardwareKeyboard.instance.isShiftPressed,
    ../../Pub/Cache/hosted/pub.dev/flet-0.20.1/lib/src/controls/page.dart:223:62: Error: The getter 'isMetaPressed' isn't defined for the class 'HardwareKeyboard'.
  • 'HardwareKeyboard' is from 'package:flutter/src/services/hardware_keyboard.dart' ('/C:/flutter/packages/flutter/lib/src/services/hardware_keyboard.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'isMetaPressed'.
    isMetaPressed: HardwareKeyboard.instance.isMetaPressed)
    ^^^^^^^^^^^^^
    ../../Pub/Cache/hosted/pub.dev/flet-0.20.1/lib/src/controls/text.dart:72:12: Error: 'FontVariation' isn't a type.
    List variations = [];
    ../../Pub/Cache/hosted/pub.dev/flet-0.20.1/lib/src/controls/text.dart:75:18: Error: The method 'FontVariation' isn't defined for the class 'TextControl'.
  • 'TextControl' is from 'package:flet/src/controls/text.dart' ('../../Pub/Cache/hosted/pub.dev/flet-0.20.1/lib/src/controls/text.dart').
    eyboard'.
  • 'HardwareKeyboard' is from 'package:flutter/src/services/hardware_keyboard.dart' ('/C:/flutter/packages/flutter/lib/src/services/hardware_keyboard.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'isShiftPressed'. eyboard'.
    if (!HardwareKeyboard.instance.isShiftPressed && ).
    ^^^^^^^^^^^^^^
    Target kernel_snapshot failed: Exception

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:compileFlutterBuildRelease'.

Error log flet 0.19 on android device -----------------------------------------------------------------------
Traceback (most recent call last):
File "", line 40, in
File "", line 229, in run_module
File "", line 88, in run_code
File "C:\Users\SSosa\AppData\Local\Temp\serious_python_temp89325f1b\main.py", line 394, in
File "C:\Users\SSosa\AppData\Local\Temp\serious_python_temp89325f1b_pypackages
\flet_runtime\app.py", line 91, in app
File "C:\Users\SSosa\AppData\Local\Temp\serious_python_temp89325f1b_pypackages_\flet_runtime\app.py", line 128, in _app_sync
File "C:\Users\SSosa\AppData\Local\Temp\serious_python_temp89325f1b_pypackages
\flet_runtime\app.py", line 385, in connect_internal_sync
File "C:\Users\SSosa\AppData\Local\Temp\serious_python_temp89325f1b_pypackages
\flet_runtime\sync_local_socket_connection.py", line 72, in connect
File "C:\Users\SSosa\AppData\Local\Temp\serious_python_temp89325f1b_pypackages
\flet_runtime\sync_local_socket_connection.py", line 158, in _connection_loop
File "C:\Users\SSosa\AppData\Local\Temp\serious_python_temp89325f1b_pypackages
\flet_runtime\sync_local_socket_connection.py", line 82, in __on_message
TypeError: RegisterWebClientRequestPayload.init() missing 1 required positional argument: 'media'

@kiebak3r
Copy link

Similar error is happening with flet build web -v

OK Building web app... Run subprocess: ['C:\\Users\\kbaker\\Downloads\\flutter_windows_3.16.9-stable\\flutter\\bin\\flutter.BAT', 'build', 'web'] Resolving dependencies... (2.2s) ffi 2.1.0 (2.1.2 available) fl_chart 0.65.0 (0.66.2 available) flutter_lints 2.0.3 (3.0.1 available) flutter_native_splash 2.3.7 (2.3.11 available) http 1.2.0 (1.2.1 available) js 0.6.7 (0.7.1 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.12.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) test_api 0.6.1 (0.7.0 available) toml 0.14.0 (0.15.0 available) web 0.3.0 (0.5.0 available) web_socket_channel 2.4.0 (2.4.4 available) xml 6.3.0 (6.5.0 available) Got dependencies! 18 packages have newer versions incompatible with dependency constraints. Try flutter pub outdated` for more information.

Target dart2js failed: ProcessException: Process exited abnormally:
../../Pub/Cache/hosted/pub.dev/flet-0.20.1/lib/src/utils/text.dart:156:8:
Error: 'FontVariation' isn't a type.
List? variations;
^^^^^^^^^^^^^
../../Pub/Cache/hosted/pub.dev/flet-0.20.1/lib/src/utils/text.dart:158:19:
Error: Method not found: 'FontVariation'.
variations = [FontVariation('wght', parseDouble(fontWeight.substring(1)))];
^^^^^^^^^^^^^
../../Pub/Cache/hosted/pub.dev/flet-0.20.1/lib/src/controls/cupertino_textfield.dart:54:40:
Error: The getter 'isShiftPressed' isn't defined for the class 'HardwareKeyboard'.

  • 'HardwareKeyboard' is from 'package:flutter/src/services/hardware_keyboard.dart' ('../../../../Downloads/flutter_windows_3.16.9-stable/flutter/packages/flutter/lib/src/services/hardware_keyboard.dart').
    if (!HardwareKeyboard.instance.isShiftPressed &&
    ^^^^^^^^^^^^^^
    ../../Pub/Cache/hosted/pub.dev/flet-0.20.1/lib/src/controls/page.dart:219:61:
    Error: The getter 'isAltPressed' isn't defined for the class 'HardwareKeyboard'.
  • 'HardwareKeyboard' is from 'package:flutter/src/services/hardware_keyboard.dart' ('../../../../Downloads/flutter_windows_3.16.9-stable/flutter/packages/flutter/lib/src/services/hardware_keyboard.dart').
    isAltPressed: HardwareKeyboard.instance.isAltPressed,
    ^^^^^^^^^^^^
    ../../Pub/Cache/hosted/pub.dev/flet-0.20.1/lib/src/controls/page.dart:221:51:
    Error: The getter 'isControlPressed' isn't defined for the class 'HardwareKeyboard'.
  • 'HardwareKeyboard' is from 'package:flutter/src/services/hardware_keyboard.dart' ('../../../../Downloads/flutter_windows_3.16.9-stable/flutter/packages/flutter/lib/src/services/hardware_keyboard.dart').
    HardwareKeyboard.instance.isControlPressed,
    ^^^^^^^^^^^^^^^^
    ../../Pub/Cache/hosted/pub.dev/flet-0.20.1/lib/src/controls/page.dart:222:63:
    Error: The getter 'isShiftPressed' isn't defined for the class 'HardwareKeyboard'.
  • 'HardwareKeyboard' is from 'package:flutter/src/services/hardware_keyboard.dart' ('../../../../Downloads/flutter_windows_3.16.9-stable/flutter/packages/flutter/lib/src/services/hardware_keyboard.dart').
    isShiftPressed: HardwareKeyboard.instance.isShiftPressed,
    ^^^^^^^^^^^^^^
    ../../Pub/Cache/hosted/pub.dev/flet-0.20.1/lib/src/controls/page.dart:223:62:
    Error: The getter 'isMetaPressed' isn't defined for the class 'HardwareKeyboard'.
  • 'HardwareKeyboard' is from 'package:flutter/src/services/hardware_keyboard.dart' ('../../../../Downloads/flutter_windows_3.16.9-stable/flutter/packages/flutter/lib/src/services/hardware_keyboard.dart').
    isMetaPressed: HardwareKeyboard.instance.isMetaPressed)
    ^^^^^^^^^^^^^
    ../../Pub/Cache/hosted/pub.dev/flet-0.20.1/lib/src/controls/text.dart:72:12:
    Error: 'FontVariation' isn't a type.
    List variations = [];
    ^^^^^^^^^^^^^
    ../../Pub/Cache/hosted/pub.dev/flet-0.20.1/lib/src/controls/text.dart:75:18:
    Error: The method 'FontVariation' isn't defined for the class 'TextControl'.
  • 'TextControl' is from 'package:flet/src/controls/text.dart' ('../../Pub/Cache/hosted/pub.dev/flet-0.20.1/lib/src/controls/text.dart').
    .add(FontVariation('wght', parseDouble(fontWeight.substring(1))));
    ^^^^^^^^^^^^^
    ../../Pub/Cache/hosted/pub.dev/flet-0.20.1/lib/src/controls/textfield.dart:52:40:
    Error: The getter 'isShiftPressed' isn't defined for the class 'HardwareKeyboard'.
  • 'HardwareKeyboard' is from 'package:flutter/src/services/hardware_keyboard.dart' ('../../../../Downloads/flutter_windows_3.16.9-stable/flutter/packages/flutter/lib/src/services/hardware_keyboard.dart').
    if (!HardwareKeyboard.instance.isShiftPressed &&
    ^^^^^^^^^^^^^^
    Error: Compilation failed.
    Command: C:\Users\kbaker\Downloads\flutter_windows_3.16.9-stable\flutter\bin\cache\dart-sdk\bin\dart.exe --disable-dart-dev
    C:\Users\kbaker\Downloads\flutter_windows_3.16.9-stable\flutter\bin\cache\dart-sdk\bin\snapshots\dart2js.dart.snapshot
    --platform-binaries=C:\Users\kbaker\Downloads\flutter_windows_3.16.9-stable\flutter\bin\cache\flutter_web_sdk\kernel --invoker=flutter_tool -Ddart.vm.product=true -DFLUTTER_WEB_AUTO_DETECT=true
    -DFLUTTER_WEB_CANVASKIT_URL=https://www.gstatic.com/flutter-canvaskit/f40e976bedff57e69e1b3d89a7c2a3c617a03dad/ --native-null-assertions --no-source-maps -o
    C:\Users\kbaker\AppData\Local\Temp\flet_flutter_build_KbqLVNeEkL.dart_tool\flutter_build\b779e5d85af94553c9f66d8f8452d663\app.dill --packages=.dart_tool/package_config.json --cfe-only
    C:\Users\kbaker\AppData\Local\Temp\flet_flutter_build_KbqLVNeEkL.dart_tool\flutter_build\b779e5d85af94553c9f66d8f8452d663\main.dart
    #0 RunResult.throwException (package:flutter_tools/src/base/process.dart:127:5)
    Authentication #1 _DefaultProcessUtils.run (package:flutter_tools/src/base/process.dart:280:19)
#2 Dart2JSTarget.build (package:flutter_tools/src/build_system/targets/web.dart:189:5) #3 _BuildInstance._invokeInternal (package:flutter_tools/src/build_system/build_system.dart:853:9) #4 Future.wait. (dart:async/future.dart:523:21) #5 _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:791:32) #6 Future.wait. (dart:async/future.dart:523:21) #7 _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:791:32) #8 FlutterBuildSystem.build (package:flutter_tools/src/build_system/build_system.dart:620:16) #9 WebBuilder.buildWeb (package:flutter_tools/src/web/compile.dart:89:34) #10 BuildWebCommand.runCommand (package:flutter_tools/src/commands/build_web.dart:199:5) #11 FlutterCommand.run. (package:flutter_tools/src/runner/flutter_command.dart:1367:27) #12 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19) #13 CommandRunner.runCommand (package:args/command_runner.dart:212:13) #14 FlutterCommandRunner.runCommand. (package:flutter_tools/src/runner/flutter_command_runner.dart:348:9) #15 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19) #16 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:294:5) #17 run.. (package:flutter_tools/runner.dart:112:9) #18 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19) #19 main (package:flutter_tools/executable.dart:90:3)

Compiling lib\main.dart for the Web... 18.5s
Exception: Failed to compile application for the Web.
Deleting Flutter bootstrap directory C:\Users\kbaker\AppData\Local\Temp\flet_flutter_build_KbqLVNeEkL
Error building Flet app - see the log of failed command above.
`

@FeodorFitsner
Copy link
Contributor

Upgrade Flutter SDK to 3.19 with flutter upgrade --force command.

@rutopio
Copy link

rutopio commented Feb 17, 2024

I've upgraded Flutter version to solve HardwareKeyboard/FontVariation error.

  • Upgrade Flutter
$ flutter upgrade --force
  • Check Flutter Version
$ flutter --version
> Flutter 3.19.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision bae5e49bc2 (4 days ago) • 2024-02-13 17:46:18 -0800
Engine • revision 04817c99c9
Tools • Dart 3.3.0 • DevTools 2.31.1
  • Check Flet Version
$ pip show flet
> Name: flet
Version: 0.20.0

@SebastianSosa
Copy link
Author

I updated Flet, and now the APK build works. However, in the Android app, I encounter the error message: 'Unknown control audio.' Same isue with the basic audio example provided in official website: https://flet.dev/docs/controls/audio/.

I am on flet 0.20.1, Flutter 3.19.0, python 3.11.6

@FeodorFitsner
Copy link
Contributor

@SebastianSosa include flet_audio package when building APK:

flet build apk --include-packages flet_audio

@SebastianSosa
Copy link
Author

It work! Thank you very much! The package is amazing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants