Flutter - IOS 应用的 Firebase Crashlytics 安装时出错

edn*_*edn 8 ios firebase crashlytics flutter google-cloud-functions

我按照此处的说明安装和测试 Firebase Crashlytics:

以下是其中一个步骤中需要完成的操作:

iOS系统

在 Xcode 中,从项目导航中选择 Runner。

选择“构建阶段”选项卡,然后单击“+”>“新建运行脚本阶段”。

将以下内容添加到 Shell 属性下方的“键入脚本...”文本框中:

我按照上面的说明将以下内容粘贴到 XCode 中:

$PODS_ROOT/FirebaseCrashlytics/upload-symbols --build-phase --validate -ai <googleAppId>
$PODS_ROOT/FirebaseCrashlytics/upload-symbols --build-phase -ai <googleAppId>
Run Code Online (Sandbox Code Playgroud)

哦!我<googleAppId>用从 Firebase 获得的真实 AppId 进行更改。

当我再次启动我的应用程序时,出现以下错误:

 2021-12-23 19:16:50.044 upload-symbols[31089:256482] Unable to get file attributes for dSYM file at path "/Users/ednuser/Developer/FlutterProjects/MyProject/build/ios/Debug-iphoneos/Runner.app.dSYM/Contents/Resources/DWARF/Runner"
        2021-12-23 19:16:51.049 upload-symbols[31089:256482] Unable to get file attributes for dSYM file at path "/Users/ednuser/Developer/FlutterProjects/MyProject/build/ios/Debug-iphoneos/Runner.app.dSYM/Contents/Resources/DWARF/Runner"
        2021-12-23 19:16:52.054 upload-symbols[31089:256482] Unable to get file attributes for dSYM file at path "/Users/ednuser/Developer/FlutterProjects/MyProject/build/ios/Debug-iphoneos/Runner.app.dSYM/Contents/Resources/DWARF/Runner"
        2021-12-23 19:16:53.060 upload-symbols[31089:256482] Unable to get file attributes for dSYM file at path "/Users/ednuser/Developer/FlutterProjects/MyProject/build/ios/Debug-iphoneos/Runner.app.dSYM/Contents/Resources/DWARF/Runner"
        2021-12-23 19:16:54.061 upload-symbols[31089:256482] Unable to get file attributes for dSYM file at path "/Users/ednuser/Developer/FlutterProjects/MyProject/build/ios/Debug-iphoneos/Runner.app.dSYM/Contents/Resources/DWARF/Runner"
        2021-12-23 19:16:55.066 upload-symbols[31089:256482] Unable to get file attributes for dSYM file at path "/Users/ednuser/Developer/FlutterProjects/MyProject/build/ios/Debug-iphoneos/Runner.app.dSYM/Contents/Resources/DWARF/Runner"
        2021-12-23 19:16:56.072 upload-symbols[31089:256482] Unable to get file attributes for dSYM file at path "/Users/ednuser/Developer/FlutterProjects/MyProject/build/ios/Debug-iphoneos/Runner.app.dSYM/Contents/Resources/DWARF/Runner"
        2021-12-23 19:16:57.076 upload-symbols[31089:256482] Unable to get file attributes for dSYM file at path "/Users/ednuser/Developer/FlutterProjects/MyProject/build/ios/Debug-iphoneos/Runner.app.dSYM/Contents/Resources/DWARF/Runner"
        2021-12-23 19:16:58.080 upload-symbols[31089:256482] Unable to get file attributes for dSYM file at path "/Users/ednuser/Developer/FlutterProjects/MyProject/build/ios/Debug-iphoneos/Runner.app.dSYM/Contents/Resources/DWARF/Runner"
        2021-12-23 19:16:59.085 upload-symbols[31089:256482] Unable to get file attributes for dSYM file at path "/Users/ednuser/Developer/FlutterProjects/MyProject/build/ios/Debug-iphoneos/Runner.app.dSYM/Contents/Resources/DWARF/Runner"
        2021-12-23 19:17:00.087 upload-symbols[31089:256482] Unable to get file attributes for dSYM file at path "/Users/ednuser/Developer/FlutterProjects/MyProject/build/ios/Debug-iphoneos/Runner.app.dSYM/Contents/Resources/DWARF/Runner"
        Running upload-symbols in Build Phase mode
        Validating build environment for Crashlytics...
        warning: DEBUG_INFORMATION_FORMAT should be set to dwarf-with-dsym for all configurations. This could also be a timing issue, make sure the Fabric run script build phase is the last build phase and no other scripts have moved the dSYM from the location Xcode generated it. Unable to process Runner.app.dSYM at path /Users/ednuser/Developer/FlutterProjects/MyProject/build/ios/Debug-iphoneos/Runner.app.dSYM
        Make sure your project build settings are generating a dSYM file.
        Processing dSYMs...
        Command PhaseScriptExecution failed with a nonzero exit code
        note: Using new build system
        note: Planning
        note: Build preparation complete
        note: Building targets in parallel
        /Users/ednuser/Developer/FlutterProjects/MyProject/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.0.99. (in target 'leveldb-library' from project 'Pods')
    Could not build the precompiled application for the device.
    
    Error launching application on Test Iphone
       
Run Code Online (Sandbox Code Playgroud)

我在以下位置将最低 ios 目标设置为 14:

  • AppFramworkInfo.plist
  • 目标运行器 -> 常规 -> 部署信息
  • 项目运行者 -> 部署目标 -> ios 部署目标
  • ios/Podfile

当我运行我的应用程序时,我仍然收到此消息:

warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.0.99. (in target 'leveldb-library' from project 'Pods')
        Could not build the precompiled application for the device.
        
        Error launching application on Test Iphone
Run Code Online (Sandbox Code Playgroud)

我使用 MAC M1 BigSur。


我还尝试了以下方法:

  • 删除 ios/Podfile.lock

  • 并在 iOS 文件夹中运行以下命令:

    arch -x86_64 pod install --repo-update

我仍然有同样可爱的问题!

但是,如果我删除添加到 Xcode 脚本阶段的 2 行,一切都会工作得很好!

我完全没有解决方案。谁能有更好的想法?

Chr*_*n X 10

以下解决方案帮助我解决了您的问题:转到项目的构建设置,然后在构建设置中搜索调试信息格式并搜索“调试信息格式”,然后将“调试信息格式”设置为“带有 dSYM 文件的 DWARF”

使用 dsym 文件将格式设置为 dwarf

并确保构建设置中的“生成调试符号”设置为“是”。