Alif Al-Gibran
Alif Al-Gibran

Reputation: 1246

Flutter error GoogleAppMeasurement when build app in Xcode

I try to implement Firebase Messaging in ios but when I running the App error occured:

xcodebuild: error: Could not resolve package dependencies:
  failed extracting 'https://dl.google.com/firebase/ios/swiftpm/8.9.1/GoogleAppMeasurement.zip' which is required by binary target 'GoogleAppMeasurement': /Users/gibran/Library/Developer/Xcode/DerivedData/Runner-eewwhhiksecuthcstpvuemjjxbiu/SourcePackages/artifacts/extract/GoogleAppMeasurement is not a directory
  fatalError

I have followed this instruction and the error appears. I tried to make folder at SourcePackages/artifacts/extract/GoogleAppMeasurement manually, but when I re-run, the folder generates as before.

Here is my Podfile:

   # Uncomment this line to define a global platform for your project
platform :ios, '12.0'
$FirebaseSDKVersion = '8.9.1'

# 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!
  pod 'Firebase/Core'
  pod 'Firebase/Messaging'

  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

# target 'ImageNotification' do
#    use_frameworks!
#    pod 'Firebase/Core'
#    pod 'Firebase/Messaging'
# end

Anyone can help with this issue? Thanks in advance.

Upvotes: 4

Views: 5154

Answers (2)

Ngodiseni Netshifhefhe
Ngodiseni Netshifhefhe

Reputation: 213

When using firebase just add the GoogleService.plist only via Xcode and do not follow the rest of the instructions of adding the SDK. I don't know why but that causes it to fail and give such errors

Upvotes: 5

Dan
Dan

Reputation: 31

Try adding the 'GoogleAppMeasurement' as a dependency from xcode

Upvotes: 0

Related Questions