flutter 编译 aab 时出现CERTIFICATE_VERIFY_FAILED

236 阅读1分钟

flutter 编译时出现以下错误

Unhandled exception: HandshakeException: Handshake error in client (OS Error: CERTIFICATE_VERIFY_FAILED: unable to get local issuer certificate(../../third_party/boringssl/src/ssl/handsha cc:393)) 
#0 _SecureFilterImpl._handshake (dart:io-patch/secure_socket_patch.dart:99:46) 
#1 _SecureFilterImpl.handshake (dart:io-patch/secure_socket_patch.dart:143:25) 
#2 _RawSecureSocket._secureHandshake (dart:io/secure_socket.dart:920:54) 
#3 _RawSecureSocket._tryFilter (dart:io/secure_socket.dart:1049:19) <asynchronous suspension> 

FAILURE: Build failed with an exception. 
    * What went wrong: 
    Execution failed for task ':realm:downloadRealmBinaries'. > Process 'command 'C:\sdk\flutter\bin\dart.bat'' finished with non-zero exit value 255 
    * Try: > Run with --stacktrace option to get the stack trace. 
    > Run with --info or --debug option to get more log output. 
    > Run with --scan to get full insights. 
    
    * Get more help at <https://help.gradle.org> 
    BUILD FAILED in 7s

解决方法

更新最新CA的证书

certutil -generateSSTFromWU roots.sst 
certutil -addstore -f root roots.sst