为什么 flutter build ios --obfuscate --split-debug-info= 失败并出现警告,但 flutter build ios 有效?

How come flutter build ios --obfuscate --split-debug-info= failed with warnings, but flutter build ios works?

请注意,flutter build ios 工作完美,没有任何警告或错误。

但是当我这样做时 flutter build ios --obfuscate --split-debug-info=/_app/obfuscate

失败并出现此错误:

Building com.x.app for device (ios-release)...
Automatically signing iOS for device deployment using specified development team in Xcode project: YSHDK23K

Running pod install...                                             18.9s 
Running Xcode build...                                                   
                                                    
Xcode build done.                                           515.9s 
Failed to build iOS app 
Error output from Xcode build: 
↳ 
    ** BUILD FAILED ** 


Xcode's output: 
↳ 
   /_app/ios/Pods/libwebp/src/dsp/dec_neon.c:1462:38: warning: 
    variable 'sum_left' may be uninitialized when used here [-Wconditional-uninitialized] 
        const uint16x8_t sum = vaddq_u16(sum_left, sum_top); 
                                         ^~~~~~~~ 
   /_app/ios/Pods/libwebp/src/dsp/dec_neon.c:1426:3: note: variable 
    'sum_left' is declared here 
      uint16x8_t sum_left; 
      ^ 
   /_app/ios/Pods/libwebp/src/dsp/dec_neon.c:1462:48: warning: 
    variable 'sum_top' may be uninitialized when used here [-Wconditional-uninitialized] 
        const uint16x8_t sum = vaddq_u16(sum_left, sum_top); 
                                                   ^~~~~~~ 
   /_app/ios/Pods/libwebp/src/dsp/dec_neon.c:1425:3: note: variable 
    'sum_top' is declared here 
      uint16x8_t sum_top; 
      
    ...... ======= <Warnings Truncated> ========= .......

    /Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/flutter_image_compress-0.6.5+1/ios/Classes/SYP 
    ictureMetadata/SYMetadataExif.m:9:9: warning: non-portable path to file '"SYMetadataExif.h"'; specified path differs in 
    case from file name on disk [-Wnonportable-include-path] 
    #import "SYMetadataEXIF.h" 
            ^~~~~~~~~~~~~~~~~~ 
            "SYMetadataExif.h" 
    1 warning generated. 

    Command PhaseScriptExecution failed with a nonzero exit code 
    note: Using new build system 
    note: Building targets in parallel 
    note: Planning build 
    note: Constructing build description 

Encountered error while building for device. 

我从 Whosebug 收到一个错误,因此在不截断警告的情况下无法提交,因此我在中间将其切断。如果您需要更多这些警告,请询问我,我会发送给您..

我在这里错过了什么?即使在发布模式下,该应用程序也能正常工作。只有当我添加 --obfuscate 标志时它是这样的。

我终于解决了这个问题。但是这个解决方案很乏味,我不确定这是否是最好的解决方案。但我认为这是可靠的解决方案:

  1. 从您的计算机中完全删除 Flutter
  2. 使用最新版本重新安装 flutter。
  3. 在项目目录的ios文件夹中,删除“Podfile”文件、“Podfile.lock”文件和“Pods”目录。
  4. 在您的项目目录中执行flutter clean
  5. 然后按预期重新运行应用程序。

然后就可以了……至少对我来说是这样。

还有其他人有其他解决方案吗?

清除所有不需要的文件, 运行 来自终端的此命令

flutter clean && rm ios/Podfile ios/Podfile.lock pubspec.lock && rm -rf ios/Pods ios/Runner.xcworkspace