Azure 管道 Flutter Firebase 项目 iOS 生成错误

azure pipeline flutter firebase project ios build error

提问人:nagi 提问时间:11/17/2023 更新时间:11/17/2023 访问量:54

问:

使用 azure pipeline 构建一个 flutter firebase 项目,flutter build 和 pod install 都成功了,但 xcode 找不到 firebase-core 模块。

我的源构建在 Mac 上成功,但在 Azure Pipeline 上失败。 我的管道:

trigger:
- none

pool:
  vmImage: 'macos-latest'
  
variables:
      # FYI: Did you know, all Azure Pipeline variables are added to the build system environment?
      # The following variables will prevent Xcode from code-signing during build.
      # This is necessary, because we do not want to CI builds to be sensitive to code-signing settings configured by 
      # developers during development.
      # The 'exportOptions' will ultimately handle the code signing with the correct cert/prov profile.
      FLUTTER_XCODE_CODE_SIGN_IDENTITY: ""
      FLUTTER_XCODE_CODE_SIGNING_REQUIRED: NO 
steps:
- task: InstallAppleCertificate@2
  inputs:
    certSecureFile: 'certificate.p12'
    certPwd: 'password'
    keychain: 'temp'
- task: InstallAppleProvisioningProfile@1
  inputs:
    provisioningProfileLocation: 'secureFiles'
    provProfileSecureFile: 'myapp.mobileprovision'  
- task: FlutterInstall@0
  inputs:
    mode: 'auto'
    channel: 'stable'
    version: 'custom'
    customVersion: '3.10.5'
- task: FlutterBuild@0
  inputs:
    target: 'ipa'
    projectDirectory: '.'
    exportOptionsPlist: 'ios/ExportOptions.plist'   
    extraArgs: '--release --obfuscate --split-debug-info=$(Build.SourcesDirectory)/build'

- task: CmdLine@2
  inputs:
    script: 'cd ios && pod install'
- task: Xcode@5
  inputs:
    actions: 'build'
    scheme: ''
    sdk: 'iphoneos'
    configuration: 'Release'
    xcWorkspacePath: '**/*.xcodeproj/project.xcworkspace'
    xcodeVersion: 'default' # Options: 8, 9, 10, 11, 12, default, specifyPath
- task: Xcode@5
  displayName: 'Xcode Archive iOS'
  inputs:
    actions: 'archive'
    xcWorkspacePath: 'ios/Runner.xcworkspace'
    scheme: 'Runner'
    sdk: 'iphoneos'
    packageApp: true
    signingOption: 'manual'
    configuration: 'Release'
    exportOptionsPlist: 'ios/ExportOptions.plist'
    signingIdentity: '$(APPLE_CERTIFICATE_SIGNING_IDENTITY)'
    provisioningProfileUuid: '$(APPLE_PROV_PROFILE_UUID)'

(https://i.stack.imgur.com/AWYY9.png)

(https://i.stack.imgur.com/EuH85.png)

(https://i.stack.imgur.com/WscWv.png)

flutter build 和 pod install 都成功了,但是 xcode 找不到模块 firebase-core ,有什么帮助吗?

iOS Flutter Xcode Firebase Azure-Pipelines

评论


答:

0赞 Bright Ran-MSFT 11/17/2023 #1

您可以尝试使用以下方法来解决问题:

  1. 如此处所述,运行下面的命令行来安装 firebase_core 插件。

    flutter pub add firebase_core
    
  2. 转到ios文件夹,然后执行以下操作。

    • 运行命令行“pod repo update”。
    • 运行命令行“pod deintegrate”。
    • 删除 Podfile.lock 文件。您可以尝试运行命令行“flutter clean”来执行此操作。
    • 运行命令行“pod install”。

评论

0赞 nagi 11/17/2023
1、我的pubspec.yaml已经有firebase_core:^2.20.0,flutter build安装成功。
0赞 nagi 11/17/2023
2.我已经删除了podfile.lock并运行pod install,firebase_core已添加并安装,作为第二个映像,但它不起作用
0赞 Bright Ran-MSFT 11/17/2023
@nagi,您是否在本地 macOS 机器(或 VM)上尝试过同一个 flutter firebase 项目的“pod install”和“xcode build”?是否存在同样的问题?如果本地不存在该问题,请尝试在本地 macOS 计算机上设置自承载 macOS 代理以运行管道作业。
0赞 nagi 11/17/2023
正如我在第 3 行所说,我的源代码构建在 mac 上成功,并且已发布到 apple store,但在 azure 管道上失败,显示 /Users/runner/work/1/s/ios/Runner/GeneratedPluginRegistrant.m:12:9:找不到模块“firebase_core”
0赞 Bright Ran-MSFT 11/17/2023
@nagi,尝试在本地 macOS 计算机上使用自托管 macOS 代理来运行管道作业,看看它是否可以工作?您本地 macOS 的版本是什么?