Issue
desktop_webview_window fails to build for native Windows ARM64 Flutter apps.
Flutter 3.44.1 auto-selects windows-arm64 on Windows ARM hosts. The plugin target is then built as ARM64, but the plugin links the x64 WebView2 loader import library.
Evidence
Environment:
Flutter 3.44.1
Dart 3.12.1
Windows ARM64 host
desktop_webview_window 0.3.0
Build failure:
web_view.obj : error LNK2019: unresolved external symbol CreateCoreWebView2EnvironmentWithOptions
web_view_window_plugin.obj : error LNK2019: unresolved external symbol GetAvailableCoreWebView2BrowserVersionString
windows\flutter\ephemeral\.plugin_symlinks\desktop_webview_window\windows\libs\x64\Webview2Loader.dll.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'ARM64'
desktop_webview_window_plugin.dll : fatal error LNK1120: 2 unresolved externals
Current Windows CMake hardcodes x64:
add_library(Webview2 SHARED IMPORTED GLOBAL)
SET_PROPERTY(TARGET Webview2 PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/libs/x64/Webview2Loader.dll)
SET_PROPERTY(TARGET Webview2 PROPERTY IMPORTED_IMPLIB ${CMAKE_CURRENT_SOURCE_DIR}/libs/x64/Webview2Loader.dll.lib)
The package only includes:
windows/libs/x64/WebView2Loader.dll
windows/libs/x64/WebView2Loader.dll.lib
Root Cause
The plugin always links the x64 WebView2 loader import library, regardless of the Windows build architecture.
On Windows ARM64 builds, MSVC cannot link an x64 .lib into an ARM64 plugin DLL, which produces LNK4272 and unresolved WebView2 symbols.
Suggested Fix
Ship WebView2 loader binaries for all supported Windows architectures and select the correct directory from CMake.
Suggested layout:
windows/libs/x64/WebView2Loader.dll
windows/libs/x64/WebView2Loader.dll.lib
windows/libs/arm64/WebView2Loader.dll
windows/libs/arm64/WebView2Loader.dll.lib
Suggested CMake behavior:
if(CMAKE_GENERATOR_PLATFORM MATCHES "ARM64")
set(WEBVIEW2_LOADER_ARCH "arm64")
else()
set(WEBVIEW2_LOADER_ARCH "x64")
endif()
set_property(TARGET Webview2 PROPERTY IMPORTED_LOCATION
${CMAKE_CURRENT_SOURCE_DIR}/libs/${WEBVIEW2_LOADER_ARCH}/WebView2Loader.dll)
set_property(TARGET Webview2 PROPERTY IMPORTED_IMPLIB
${CMAKE_CURRENT_SOURCE_DIR}/libs/${WEBVIEW2_LOADER_ARCH}/WebView2Loader.dll.lib)
Microsoft ships the ARM64 WebView2 loader in the Microsoft.Web.WebView2 NuGet package.
Issue
desktop_webview_windowfails to build for native Windows ARM64 Flutter apps.Flutter 3.44.1 auto-selects
windows-arm64on Windows ARM hosts. The plugin target is then built as ARM64, but the plugin links the x64 WebView2 loader import library.Evidence
Environment:
Build failure:
Current Windows CMake hardcodes x64:
The package only includes:
Root Cause
The plugin always links the x64 WebView2 loader import library, regardless of the Windows build architecture.
On Windows ARM64 builds, MSVC cannot link an x64
.libinto an ARM64 plugin DLL, which producesLNK4272and unresolved WebView2 symbols.Suggested Fix
Ship WebView2 loader binaries for all supported Windows architectures and select the correct directory from CMake.
Suggested layout:
Suggested CMake behavior:
Microsoft ships the ARM64 WebView2 loader in the
Microsoft.Web.WebView2NuGet package.