PR

[Flutter]Google Mobile AdsでiOSビルドが通らない問題をPodfileへ1行追加しただけで解決した話

Flutter

はじめに

久しぶりにFlutterで個人開発アプリを作っていたときにハマった内容のメモです。

環境

  • Flutter 3.35.1
  • google_mobile_ads: 6.0.0
  • Xcode 16.4

エラー内容

CocoaPods' output:

      Preparing

    Analyzing dependencies

    Inspecting targets to integrate
      Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)
      Using `ARCHS` setting to build architectures of target `Pods-RunnerTests`: (``)

    Fetching external sources
    -> Fetching podspec for `Flutter` from `Flutter`
    -> Fetching podspec for `app_tracking_transparency` from `.symlinks/plugins/app_tracking_transparency/ios`
    -> Fetching podspec for `desktop_webview_auth` from `.symlinks/plugins/desktop_webview_auth/ios`
    -> Fetching podspec for `google_mobile_ads` from `.symlinks/plugins/google_mobile_ads/ios`

    Resolving dependencies of `Podfile`
      CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only performed in repo update
      CDN: trunk Relative path: all_pods_versions_5_9_a.txt exists! Returning local because checking is only performed in repo update
      CDN: trunk Relative path: Specs/5/9/a/Google-Mobile-Ads-SDK/12.10.0/Google-Mobile-Ads-SDK.podspec.json exists! Returning local because checking is only performed in repo update
      CDN: trunk Relative path: all_pods_versions_e_9_b.txt exists! Returning local because checking is only performed in repo update
    [!] Unable to find a specification for `webview_flutter_wkwebview` depended upon by `google_mobile_ads`

    You have either:
     * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
     * mistyped the name or version.
     * not added the source repo that hosts the Podspec to your Podfile.

    /opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/gems/cocoapods-1.16.2/lib/cocoapods/resolver.rb:389:in 'Pod::Resolver#find_cached_set'
    /opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/gems/cocoapods-1.16.2/lib/cocoapods/resolver.rb:360:in 'Pod::Resolver#specifications_for_dependency'
    /opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/gems/cocoapods-1.16.2/lib/cocoapods/resolver.rb:165:in 'Pod::Resolver#search_for'
    /opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/gems/cocoapods-1.16.2/lib/cocoapods/resolver.rb:274:in 'block in Pod::Resolver#sort_dependencies'
    /opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/gems/cocoapods-1.16.2/lib/cocoapods/resolver.rb:267:in 'Array#each'
    /opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/gems/cocoapods-1.16.2/lib/cocoapods/resolver.rb:267:in 'Enumerable#sort_by'
    /opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/gems/cocoapods-1.16.2/lib/cocoapods/resolver.rb:267:in 'Array#sort_by!'
    /opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/gems/cocoapods-1.16.2/lib/cocoapods/resolver.rb:267:in 'Pod::Resolver#sort_dependencies'
    /opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/gems/molinillo-0.8.0/lib/molinillo/delegates/specification_provider.rb:60:in 'block in Molinillo::Delegates::SpecificationProvider#sort_dependencies'
    /opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/gems/molinillo-0.8.0/lib/molinillo/delegates/specification_provider.rb:77:in 'Molinillo::Delegates::SpecificationProvider#with_no_such_dependency_error_handling'
    /opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/gems/molinillo-0.8.0/lib/molinillo/delegates/specification_provider.rb:59:in 'Molinillo::Delegates::SpecificationProvider#sort_dependencies'
    /opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:754:in 'Molinillo::Resolver::Resolution#push_state_for_requirements'
    /opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:744:in 'Molinillo::Resolver::Resolution#require_nested_dependencies_for'
    /opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:727:in 'Molinillo::Resolver::Resolution#activate_new_spec'
    /opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:684:in 'Molinillo::Resolver::Resolution#attempt_to_activate'
    /opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:254:in 'Molinillo::Resolver::Resolution#process_topmost_state'
    /opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:182:in 'Molinillo::Resolver::Resolution#resolve'
    /opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/gems/molinillo-0.8.0/lib/molinillo/resolver.rb:43:in 'Molinillo::Resolver#resolve'
    /opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/gems/cocoapods-1.16.2/lib/cocoapods/resolver.rb:94:in 'Pod::Resolver#resolve'
    /opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/gems/cocoapods-1.16.2/lib/cocoapods/installer/analyzer.rb:1082:in 'block in Pod::Installer::Analyzer#resolve_dependencies'
    /opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/gems/cocoapods-1.16.2/lib/cocoapods/user_interface.rb:64:in 'Pod::UserInterface.section'
    /opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/gems/cocoapods-1.16.2/lib/cocoapods/installer/analyzer.rb:1080:in 'Pod::Installer::Analyzer#resolve_dependencies'
    /opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/gems/cocoapods-1.16.2/lib/cocoapods/installer/analyzer.rb:125:in 'Pod::Installer::Analyzer#analyze'
    /opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/gems/cocoapods-1.16.2/lib/cocoapods/installer.rb:422:in 'Pod::Installer#analyze'
    /opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/gems/cocoapods-1.16.2/lib/cocoapods/installer.rb:244:in 'block in Pod::Installer#resolve_dependencies'
    /opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/gems/cocoapods-1.16.2/lib/cocoapods/user_interface.rb:64:in 'Pod::UserInterface.section'
    /opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/gems/cocoapods-1.16.2/lib/cocoapods/installer.rb:243:in 'Pod::Installer#resolve_dependencies'
    /opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/gems/cocoapods-1.16.2/lib/cocoapods/installer.rb:162:in 'Pod::Installer#install!'
    /opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/gems/cocoapods-1.16.2/lib/cocoapods/command/install.rb:52:in 'Pod::Command::Install#run'
    /opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/gems/claide-1.1.0/lib/claide/command.rb:334:in 'CLAide::Command.run'
    /opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/gems/cocoapods-1.16.2/lib/cocoapods/command.rb:52:in 'Pod::Command.run'
    /opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/gems/cocoapods-1.16.2/bin/pod:55:in '<top (required)>'
    /opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/bin/pod:25:in 'Kernel#load'
    /opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/bin/pod:25:in '<main>'

Error: CocoaPods's specs repository is too out-of-date to satisfy dependencies.
To update the CocoaPods specs, run:
  pod repo update

Error running pod install
Error launching application on iPhone 16 Pro Max.

解決方法

Podfile を以下のように変更します。

target 'Runner' do
  use_frameworks!

+  pod 'webview_flutter_wkwebview', :path => '.symlinks/plugins/webview_flutter_wkwebview/darwin'

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
  target 'RunnerTests' do
    inherit! :search_paths
  end
end

まとめ

クロスプラットフォームってこういう問題が出やすいのが嫌ですよね。

まぁ、Flutterのおかげ色々と楽させてもらっているのでなんとも言えませんが。。。

おすすめ書籍

参考リンク

Pod install fails with "Unable to find a specification for `webview_flutter_wkwebview` depended upon by `google_mobile_ads`" · Issue #1222 · googleads/googleads-mobile-flutter
Step 1: Describe your environment Plugin Version google_mobile_ads: ^5.2.0 Step 2: Describe the problem Steps to Reprodu...

コメント

タイトルとURLをコピーしました