Home > Net >  Can't build ipa for Flutter project [CocoaPods could not find compatible versions for pod "
Can't build ipa for Flutter project [CocoaPods could not find compatible versions for pod "

Time:07-06

I’ve spent days stuck on this. I’ve tried many flutter pub and pod commands but nothing works. I've also deleted the pods folder and re-added the firebase-ios-sdk.

I keep seeing this :

  In Podfile:
    firebase_analytics (from `.symlinks/plugins/firebase_analytics/ios`) was resolved to 9.1.12, which depends on
      Firebase/Analytics (= 9.2.0) was resolved to 9.2.0, which depends on
        Firebase/Core (= 9.2.0) was resolved to 9.2.0, which depends on
          FirebaseAnalytics (~> 9.2.0) was resolved to 9.2.0, which depends on
            FirebaseAnalytics/AdIdSupport (= 9.2.0) was resolved to 9.2.0, which depends on
              GoogleAppMeasurement (= 9.2.0)

    google_mobile_ads (from `.symlinks/plugins/google_mobile_ads/ios`) was resolved to 0.0.1, which depends on
      Google-Mobile-Ads-SDK (= 8.13.0) was resolved to 8.13.0, which depends on
        GoogleAppMeasurement (< 9.0, >= 7.0)

So I got desperate, deleted the whole ios folder and then run flutter create . it regenerated everything and then I run flutterfire configure. Everything seemed fine but I still can't build or run the app targeting ios. I think somehow, xcode is preserving some settings or files and pod cache clean is not even deleting that. What should I delete/nuke in xcode? I'm tired.

Podfile :

platform :ios, '12.0'

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

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

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

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  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)
  end
end

CodePudding user response:

Delete

.symlinks filder

Pods

Podfile.lock

Run flutter clean

Then try building it

CodePudding user response:

So I found the solution. After staring at Google-Mobile-Ads-SDK for hours I thought why not just manually change the version in the .symlinks folder. I did not work and I got some error about some missing credential. So then I searched for google_mobile_ads ios and found out that the latest version available is so high up. The maximum version flutter uses is from 2021‑11‑17 last year. My guess is there might be trouble migrating it to SDK v9 (I don't know what that is). Anyways that's just a theory, I don't know much about iOS plugins.

Now the solution, I figured at least someone on github has had this same issue and I was right google_mobile_ads it's a p1 issue so hopefully it'll be fixed soon. For now, just replace the dependency like this:

  google_mobile_ads:
    git:
      url: https://github.com/jjliu15/googleads-mobile-flutter-1.git
      ref: update_version
      path: packages/google_mobile_ads/

And it'll work like @jonafeucht on github said. It's a workaround but I've found no isssues with it so far. Although I had to fix a few other issues I created for myself in an attempt to get the project to run.

  • Related