flutter flutter_distributor打包错误

报错如:Done Adding Additional Store Error information: "Error: SignerSign() failed." (-2147024885/0x8007000b) SignTool Error: An unexpected internal error has occurred. Unhandled exception: SignTool Error: An unexpected internal error has occurred. #0 ProcessResultExtensions.exitOnError (package:msix/src/method_extensions.dart:77:7) #1 SignTool.sign (package:msix/src/sign_tool.dart:219:9) <asynchronous suspension> #2 Msix._packMsixFiles (package:msix/msix.dart:149:7) <asynchronous suspension> #3 Msix._createMsix (package:msix/msix.dart:103:5) <asynchronous suspension> #4 Msix.create (package:msix/msix.dart:59:5) <asynchronous suspension> #5 AppPackageMakerMsix._make (package:flutter_app_packager/src/makers/msix/app_package_maker_msix.dart:59:5) <asynchronous suspension> #6 UnifiedDistributor.package (package:unified_distributor/src/unified_distributor.dart:197:35) <asynchronous suspension> #7 CommandRunner.runCommand (package:args/command_runner.dart:212:13) <asynchronous suspension> #8 main (file:///C:/Users/Administrator/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_distributor-0.6.6/bin/main.dart:10:10) <asynchronous suspension>

flutter项目对window端进行打包时,默认是一堆dll、exe、data等文件,需要对打包后的再次打包成一个exe文件。

打包生成的命令如下:

flutter pub global activate flutter_distributor

New-SelfSignedCertificate -Type CodeSigningCert -Subject "CN=xxxx-xxxx" -CertStoreLocation "Cert:\CurrentUser\My"

$pwd = ConvertTo-SecureString -String "ourfastNb" -Force -AsPlainText

Export-PfxCertificate -Cert Cert:\CurrentUser\My\<证书指纹> -FilePath .\windows\sign.pfx -Password $pwd

原因:你证书的CN=xxxx-xxxx与项目中make_config.yaml配置的publisher不同。

解决:将项目中的window配置中通过msix生成的make_config.yaml的publisher改成与证书一致。

make_config.yaml一般在xxx项目\windows\packaging\msix\下面。如果没有,你需要在pubspec.yaml中添加额外配置:

msix_config:

certificate_path: windows/sign.pfx

certificate_password: "ourfastNb"

具体解释:

使用 SignTool 时最常见的错误类型是内部错误,通常如下所示:

syntax

复制代码
SignTool Error: An unexpected internal error has occurred.
Error information: "Error: SignerSign() failed." (-2147024885 / 0x8007000B) 

如果错误代码以0x8008开头(例如0x80080206(APPX_E_CORRUPT_CONTENT),则正在签名的包无效。 如果收到此类错误,则必须重新生成包并再次运行 SignTool

SignTool 具有可用于显示证书错误和筛选的调试选项。 若要使用调试功能,请直接将 /debug 选项置于后面 sign,然后是完整的 SignTool 命令。

syntax

复制代码
SignTool sign /debug [options]

更常见的错误是0x8007000B。 对于这种类型的错误,可以在事件日志中找到详细信息。

若要在事件日志中查找详细信息,请执行以下操作。

  • 运行 Eventvwr.msc
  • 打开事件日志:事件查看器(本地)-> 应用程序和服务日志 -> Microsoft -> Windows -> AppxPackagingOM -> Microsoft-Windows-AppxPackaging/Operational
  • 查找最新的错误事件

内部错误0x8007000B通常对应于以下值之一:

事件 ID 示例事件字符串 建议
150 错误0x8007000B:应用清单发布者名称(CN=Contoso)必须与签名证书的使用者名称(CN=Contoso,C=US)匹配。 应用清单发布者名称必须与签名的主题名称完全匹配。
151 错误0x8007000B:指定的签名哈希方法(SHA512)必须与应用包块映射(SHA256)中使用的哈希方法匹配。 /fd 参数中指定的 hashAlgorithm 不正确。 请使用与应用包块映射匹配的哈希算法重新运行SignTool(该映射用于创建应用包)
152 错误0x8007000B:应用包内容必须根据其块映射进行验证。 应用包已损坏,需要重新生成新的块映射。 有关创建应用包的详细信息,请参阅 使用 MakeAppx.exe 工具创建应用包
相关推荐
曹牧3 小时前
C#:List<string>特定格式输出
windows·c#
易点云徐源5 小时前
(已解决)Photoshop 多画板 Alt+拖动复制随机卡死 4~5 分钟
windows·photoshop
Dovis(誓平步青云)5 小时前
DevEco Studio 6.1.1 Windows 安装实录:从下载校验到首次启动
android·开发语言·数据库·人工智能·windows·harmonyos
Zender Han5 小时前
Flutter 自适应(Adaptive)与响应式(Responsive)设计实践:官方推荐方案详解
android·flutter·ios
bosins6 小时前
将 Hyper-V 上的 Ubuntu 虚拟机内容迁移到 WSL (Windows Subsystem for Linux) 中
linux·windows·ubuntu
ι:7 小时前
DeepSeek Harness 桌面一键启动与网页背景修改指南
windows·学习·deepseekharness
zuozewei8 小时前
7DGroup 开源 dsh-7d-tray-win 系统托盘插件
windows·代码复审
深念Y9 小时前
Wine 运行 HiTool 踩坑记录
linux·windows·容器·桌面·wine·虚拟器
玖釉-9 小时前
nvpro_core2 源码与架构解析:NVIDIA Vulkan 图形开发基础框架
c++·windows·图形渲染
淡海水10 小时前
01-08-运行时-虚方法分派与接口调用的底层实现
linux·windows·microsoft·c#·虚方法·vtable·vsd