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

Posted

技术标签:

【中文标题】为啥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 --obfuscate --split-debug-info= 失败并出现警告,但flutter build ios 有效? 【发布时间】:2020-10-13 04:00:04 【问题描述】:

请注意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. 

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

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

【问题讨论】:

【参考方案1】:

最后我解决了这个问题。但是解决方案很乏味,我不确定这是否是最好的解决方案。但我认为这是稳健的解决方案:

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

然后它起作用了……至少对我来说。

还有其他解决方案吗?

【讨论】:

【参考方案2】:

清理所有不需要的文件, 从终端运行此命令

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

【讨论】:

以上是关于为啥flutter build ios --obfuscate --split-debug-info= 失败并出现警告,但flutter build ios 有效?的主要内容,如果未能解决你的问题,请参考以下文章

Flutter 在执行 Flutter build ios 后卡在 Building Dart 代码上

Flutter 应用程序不是由 Flutter build ios 运行,而是由 xcode 运行

Flutter build ios bitcode问题,如何修复bitcode错误

Flutter ios release build 找不到快照

Flutter App IOS Release Build 错误:缺少所需的图标文件

为啥在使用 Flutter 模块构建 iOS 原生应用时修复“Frameworks/Flutter.framework: Permission denied”?