tjarvstrand / flutter_timezone

A fork of https://github.com/pinkfish/flutter_native_timezone
Apache License 2.0
42 stars 29 forks source link

The program cannot be started on the Windows platform. #33

Closed lan2000 closed 2 weeks ago

lan2000 commented 1 month ago

The program cannot be started on the Windows platform.

When trying to start the program, an error is reported: Unable to locate the program entry point ucal_getHostTimeZone in the dynamic link library. The path is: project path\build\windows\x64\runner\Debug\flutter_timezone_plugin.dll.

flutter_timezone: ^2.1.0

Flutter (Channel stable, 3.22.3, on Microsoft Windows [版本 10.0.19042.630], locale zh-CN)
    • Flutter version 3.22.3 on channel stable at D:\flutter\flutter
    ! Upstream repository unknown source is not a standard remote.
      Set environment variable "FLUTTER_GIT_URL" to unknown source to dismiss this error.
    • Framework revision b0850beeb2 (6 days ago), 2024-07-16 21:43:41 -0700
    • Engine revision 235db911ba
    • Dart version 3.4.4
    • DevTools version 2.34.3
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly
      to perform update checks and upgrades.

[√] Connected device (4 available)
    • Windows (desktop) • windows          • windows-x64    • Microsoft Windows [版本 10.0.19042.630]
tjarvstrand commented 1 month ago

Hi @lan2000! Could you please provide a minimal project that reproduces your issue?

@domyd Do you know what may be the problem here?

domyd commented 1 month ago

That's weird; the Windows version seems to be Windows 10 20H2, where the ucal_getHostTimeZone shouldn't be used:

https://github.com/tjarvstrand/flutter_timezone/blob/9a68eae913166fd3991fa24647b5a3bf75c1b91e/windows/flutter_timezone_plugin.cpp#L69C1-L75

@lan2000 Did you perhaps compile this on a different, newer Windows machine?

rodrigoreal commented 3 weeks ago

@tjarvstrand @domyd Hello guys, i'm also having this problem, i was using the 1.0.8 version and when i upgraded it the error start happening, when i downgraded back to 1.0.8 it start working again. When i run flutter run -d windows i only get this error Error waiting for a debug connection: The log reader stopped unexpectedly, or never started. Error launching application on Windows.

But when i try to launch the app from the build folder i get Entry point not found The procedure entry point ucal_getHostTimeZone could not be located in the dynamic link library. C:\Users\Rodrigo\dev\myapp\app\build\windows\x64\runner\Debug\flutter_timezone_plugin.dll

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.24.0, on Microsoft Windows [Version 10.0.19045.4651],
    locale en-001)
[✓] Windows Version (Installed version of Windows is version 10 or higher)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0-rc3)
[✓] Chrome - develop for the web
[✓] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.10.1)
[✓] Android Studio (version 2023.3)
[✓] VS Code (version 1.92.1)
[✓] Connected device (3 available)
[✓] Network resources

My windows version is Windows 10 22H2 (OS Build 19045.4651)

domyd commented 3 weeks ago

Yeah so turns out Windows 10 caps out at ICU v64, and ucal_getHostTimeZone was added in v65. So I guess we can't trust the icu.h header file when it says that Windows 10 21H2 and higher should have that function ...

All Windows 10 versions ship with ICU <= 64, Windows 11 ships with ICU 68 or newer. This isn't documented anywhere.

With that in mind it's probably best to just strip out the ucal_getHostTimeZone part altogether. It's a trivial change, I'll open a PR for it.

tjarvstrand commented 2 weeks ago

The fix kindly provided by @domyd has now been released in the new 3.0.0 version.