appodeal / Appodeal-Flutter-Plugin

Official Flutter Plugin that adds Appodeal SDK support to your Flutter application.
https://pub.dev/packages/stack_appodeal_flutter
Apache License 2.0
20 stars 3 forks source link

Flutter Build Error: Undefined symbol: __swift_FORCE_LOAD_$_swiftCompatibility56 #58

Closed takuya-ohmuro closed 9 months ago

takuya-ohmuro commented 9 months ago

I'm unable to build from Flutter due to the following error, and I need help resolving it:

Could not build the precompiled application for the device. Error (Xcode): Undefined symbol: _swift_FORCE_LOAD$_swiftCompatibility56 2. XCode 15.1

Here's my environment:

Flutter (Channel stable, 3.16.4, on macOS 14.1.1 23B81 darwin-arm64, locale ja-JP)
Android toolchain - develop for Android devices (Android SDK version 31.0.0)
Xcode - develop for iOS and macOS (Xcode 14.1)
Chrome - develop for the web
Android Studio (version 2022.3)
VS Code (version 1.85.1)
VS Code (version 1.79.0-insider)
Connected device (3 available)
Network resources
No issues were found during the Flutter doctor check.

I believe this issue is similar to the one discussed in this GitHub issue: https://github.com/appodeal/Appodeal-Flutter-Plugin/issues/50

Building directly from Xcode is possible.

Here's my podfile:

platform :ios, '13.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

use_frameworks!

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

install! 'cocoapods', :warn_for_multiple_pod_sources => false

source 'https://github.com/appodeal/CocoaPods.git'
source 'https://cdn.cocoapods.org/'

def appodeal
  pod 'Appodeal', '3.2.0'
  pod 'APDAdColonyAdapter', '3.2.0.0'
  pod 'BidMachineAdColonyAdapter', '~> 2.3.0'
  pod 'APDAppLovinAdapter', '3.2.0.0'
  pod 'BidonAdapterAppLovin', '~> 0.4.6'
  pod 'APDBidMachineAdapter', '3.2.0.0' # Required
  pod 'BidMachineAmazonAdapter', '= 2.3.0.1'
  pod 'BidMachineCriteoAdapter', '~> 2.3.0'
  pod 'BidMachineSmaatoAdapter', '~> 2.3.0'
  pod 'BidMachineTapjoyAdapter', '~> 2.3.0'
  pod 'BidMachinePangleAdapter', '~> 2.3.0'
  pod 'APDBidonAdapter', '3.2.0.0' # Required
  pod 'BidonAdapterBidMachine', '~> 0.4.6'
  pod 'BidonAdapterAmazon', '~> 0.4.6'
  pod 'APDBigoAdsAdapter', '3.2.0.0'
  pod 'BidonAdapterBigoAds', '~> 0.4.6'
  pod 'APDDTExchangeAdapter', '3.2.0.0'
  pod 'BidonAdapterDTExchange', '~> 0.4.6'
  pod 'APDIABAdapter', '3.2.0.0' # Required
  pod 'APDInMobiAdapter', '3.2.0.0'
  pod 'BidonAdapterInMobi', '~> 0.4.6'
  pod 'APDIronSourceAdapter', '3.2.0.0'
  pod 'APDMetaAudienceNetworkAdapter', '3.2.0.0'
  pod 'BidMachineMetaAudienceAdapter', '~> 2.3.0'
  pod 'BidonAdapterMetaAudienceNetwork', '~> 0.4.6'
  pod 'APDMintegralAdapter', '3.2.0.0'
  pod 'BidMachineMintegralAdapter', '= 2.3.0.3'
  pod 'BidonAdapterMintegral', '~> 0.4.6'
  pod 'APDMyTargetAdapter', '3.2.0.0'
  pod 'BidMachineMyTargetAdapter', '~> 2.3.0'
  pod 'APDStackAnalyticsAdapter', '3.2.0.0' # Required
  pod 'APDStackCrashReporterAdapter', '3.2.0.0'
  pod 'APDUnityAdapter', '3.2.0.0'
  pod 'BidonAdapterUnityAds', '~> 0.4.6'
  pod 'APDVungleAdapter', '3.2.0.0'
  pod 'BidMachineVungleAdapter', '~> 2.3.0'
  pod 'BidonAdapterVungle', '~> 0.4.6'
  pod 'APDYandexAdapter', '3.2.0.0'
end

target 'Runner' do
  use_frameworks!
  use_modular_headers!
  appodeal

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)

    target.build_configurations.each do |config|
      # --- Fix for Xcode 15.0 ---
      xcconfig_path = config.base_configuration_reference.real_path
      xcconfig = File.read(xcconfig_path)
      xcconfig_mod = xcconfig.gsub(/DT_TOOLCHAIN_DIR/, "TOOLCHAIN_DIR")
      File.open(xcconfig_path, "w") { |file| file << xcconfig_mod }
      # ---------------------------------
    end
  end
end
da2gl commented 9 months ago

@takuya-ohmuro Hello. Please use Xcode 14.3 or higher for your project. Thank you.

takuya-ohmuro commented 9 months ago

@da2gl Thank you for your reply! It has been resolved.