EAS 构建失败,React Native 项目中出现“Undefined Symbols for Architecture arm64”错误

问题描述 投票:0回答:1

❌ 架构arm64的未定义符号

┌─ 符号:_OBJC_CLASS_$_RCTEventDispatcher

└─ 参考自:__OBJC_$_CATEGORY_RCTEventDispatcher_$_Reanimated in RCTEventDispatcher+Reanimated.o

❌ld:找不到架构arm64的符号

❌ clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)

我在 VSCode 上使用 Expo 为我的 React Native 项目运行

eas build --platform ios
时遇到构建错误。构建在第 3068 行停止,并出现以下错误:

该错误似乎涉及

RCTEventDispatcher
库中的
react-native-reanimated
符号。以下是有关我的设置的一些详细信息:

  • React Native 版本:0.74.1

  • 条纹版本:0.37.2

  • react-native-reanimated 版本:3.10.1

  • 构建工具:EAS

  • 开发环境:VSCode 和 Expo

我已尝试以下步骤来解决该问题:

  1. 删除了

    node_modules
    yarn.lock
    ,然后使用
    yarn install
    重新安装了依赖项。

  2. 跑到ios目录下

    pod install --repo-update

  3. 验证了

    eas.json
    文件中的构建设置,以确保正确的架构设置。

是否有人在使用 Expo 和 VSCode 时遇到过类似的问题或对如何解决此链接器错误有任何建议?任何帮助将不胜感激!

这是我的

Podfile

platform :ios, '14.0'

require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods")

require 'json'
podfile_properties = JSON.parse(File.read(File.join(__dir__, 'Podfile.properties.json'))) rescue {}

ENV['RCT_NEW_ARCH_ENABLED'] = podfile_properties['newArchEnabled'] == 'true' ? '1' : '0'
ENV['EX_DEV_CLIENT_NETWORK_INSPECTOR'] = podfile_properties['EX_DEV_CLIENT_NETWORK_INSPECTOR']

install! 'cocoapods', :deterministic_uuids => false

use_modular_headers!

prepare_react_native_project!

target 'SP' do
  config = use_native_modules!

  use_frameworks! :linkage => :static

  use_react_native!(
    :path => config[:reactNativePath],
    :hermes_enabled => podfile_properties['expo.jsEngine'] == nil || podfile_properties['expo.jsEngine'] == 'hermes',
    :app_path => "#{Pod::Config.instance.installation_root}/..",
    :privacy_file_aggregation_enabled => podfile_properties['apple.privacyManifestAggregationEnabled'] != 'false',
  )

  pod 'Firebase/Core'
  pod 'Firebase/Auth'
  pod 'Firebase/Storage'
  pod 'react-native-reanimated', :path => '../node_modules/react-native-reanimated'

  pod 'Stripe', '~> 23.26.0'
  pod 'StripePaymentsUI', '~> 23.26.0'
  pod 'StripeApplePay', '~> 23.26.0'
  pod 'StripeFinancialConnections', '~> 23.26.0'
  pod 'StripePaymentSheet', '~> 23.26.0'

  post_install do |installer|
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false,
      :ccache_enabled => podfile_properties['apple.ccacheEnabled'] == 'true',
    )

    installer.target_installation_results.pod_target_installation_results
      .each do |pod_name, target_installation_result|
      target_installation_result.resource_bundle_targets.each do |resource_bundle_target|
        resource_bundle_target.build_configurations.each do |config|
          config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
        end
      end
    end

    installer.pods_project.targets.each do |target|
      if target.name == 'react-native-reanimated'
        target.build_configurations.each do |config|
          config.build_settings['USE_HERMES'] = 'YES'
        end
      end
    end

    # Exclude arm64 for simulator builds
    installer.pods_project.build_configurations.each do |config|
      config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
    end

    # Ensure Hermes dependencies
    installer.pods_project.targets.each do |target|
      if target.name == 'hermes-engine'
        target.add_dependency target
      end
    end
  end

  post_integrate do |installer|
    begin
      expo_patch_react_imports!(installer)
    rescue => e
      Pod::UI.warn e
    end
  end
end
reactjs react-native expo eas
1个回答
-1
投票

我在世博会上遇到了同样的错误。你解决了吗?谢谢!

© www.soinside.com 2019 - 2024. All rights reserved.