如何在Windows 10设备上构建Flutter应用的Windows 8发布版本?
构建适配Windows 8的Flutter发布版本
修改Windows平台项目配置
打开Flutter项目下的windows/runner/Runner.vcxproj文件,找到对应Debug和Release平台的属性组,将WindowsTargetPlatformVersion和WindowsTargetPlatformMinVersion的值改为Windows 8的版本号6.2.9200:<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <!-- 保留其他原有配置 --> <WindowsTargetPlatformVersion>6.2.9200</WindowsTargetPlatformVersion> <WindowsTargetPlatformMinVersion>6.2.9200</WindowsTargetPlatformMinVersion> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <!-- 保留其他原有配置 --> <WindowsTargetPlatformVersion>6.2.9200</WindowsTargetPlatformVersion> <WindowsTargetPlatformMinVersion>6.2.9200</WindowsTargetPlatformMinVersion> </PropertyGroup>若需要适配x86架构,同步修改
Debug|x86和Release|x86对应的属性组。补充CMake配置(旧版Flutter需操作)
针对部分旧版Flutter,打开windows/CMakeLists.txt,添加以下配置指定最低Windows版本:set(CMAKE_SYSTEM_VERSION 6.2.9200 CACHE STRING "" FORCE)执行发布构建
完成配置修改后,在项目根目录运行发布构建命令:flutter build windows --release兼容性验证
将build/windows/x64/release/Runner目录下的所有文件拷贝到Windows 8系统中测试运行。若出现依赖缺失,需安装对应版本的Visual C++ Redistributable运行时包。
内容的提问来源于stack exchange,提问作者TheUltimateOptimist
相关产品推荐
相关产品推荐

