After upgrading, my old Flutter project using Vcode cannot build anymore with tons of errors as below. I have tried:
- deleting Podfile.lock
- pod cache clean --all
- rm -rf ~/Library/Caches/CocoaPods
- rm -rf ~/Library/Developer/Xcode/DerivedData/*
- rm -rf Pods
- pod deintegrate
- pod setup
- pod install
flutter doctor -v
[✓] Flutter (Channel stable, v1.9.1+hotfix.6, on Mac OS X 10.15.1 19B88, locale en-SG) • Flutter version 1.9.1+hotfix.6 at /Users/peterlum/dev/flutter • Framework revision 68587a0916 (7 weeks ago), 2019-09-13 19:46:58 -0700 • Engine revision b863200c37 • Dart version 2.5.0
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3) • Android SDK at /Applications/AndroidDev/sdk • Android NDK location not configured (optional; useful for native profiling support) • Platform android-28, build-tools 28.0.3 • ANDROID_HOME = /Applications/AndroidDev/sdk • ANDROID_SDK_ROOT = /Applications/AndroidDev/sdk • Java binary at: /Applications/Android Studio 3.3.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01) • All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.2) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 11.2, Build version 11B52 • CocoaPods version 1.8.4
[✓] Android Studio (version 3.3) • Android Studio at /Applications/Android Studio 3.3.app/Contents • Flutter plugin version 34.0.1 • Dart plugin version 182.5215 • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
[!] Android Studio (version 2.3) • Android Studio at /Applications/Android Studio.app/Contents ✗ Flutter plugin version 12.1 - the recommended minimum version is 16.0.0 • Dart plugin version 162.2924 • Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)
[✓] VS Code (version 1.39.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.6.0
[✓] Connected device (2 available) • LG D855 • LGD855a710c089 • android-arm • Android 5.0 (API 21) • iPhone 6 Plus • 615DAB60-6ACB-4E37-9FAD-8CF869415B60 • ios • com.apple.CoreSimulator.SimRuntime.iOS-12-4 (simulator)
My Podfile:
# Uncomment this line to define a global platform for your project
platform :ios, '9.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 parse_KV_file(file, separator='=')
file_abs_path = File.expand_path(file)
if !File.exists? file_abs_path
return [];
end
pods_ary = []
skip_line_start_symbols = ["#", "/"]
File.foreach(file_abs_path) { |line|
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
plugin = line.split(pattern=separator)
if plugin.length == 2
podname = plugin[0].strip()
path = plugin[1].strip()
podpath = File.expand_path("#{path}", file_abs_path)
pods_ary.push({:name => podname, :path => podpath});
else
puts "Invalid plugin specification: #{line}"
end
}
return pods_ary
end
target 'Runner' do
use_frameworks!
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines.
system('rm -rf .symlinks')
system('mkdir -p .symlinks/plugins')
# Flutter Pods
generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
if generated_xcode_build_settings.empty?
puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first."
end
generated_xcode_build_settings.map { |p|
if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
symlink = File.join('.symlinks', 'flutter')
File.symlink(File.dirname(p[:path]), symlink)
pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
end
}
# Plugin Pods
plugin_pods = parse_KV_file('../.flutter-plugins')
plugin_pods.map { |p|
symlink = File.join('.symlinks', 'plugins', p[:name])
File.symlink(p[:path], symlink)
pod p[:name], :path => File.join(symlink, 'ios')
}
end
# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
install! 'cocoapods', :disable_input_output_paths => true
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end
My pubspec.yaml
name: project
description: A new Flutter project.
version: 0.9.0+1
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
firebase_auth: "0.14.0+5"
google_sign_in: "4.0.7"
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: "0.1.2"
intl: "^0.15.8" # 0.15.7
# Peter add
firebase_core: "0.4.0+9"
cloud_firestore: "0.12.9+5"
firebase_storage: "3.0.6"
firebase_admob: "0.9.0+7"
firebase_analytics: "5.0.2"
image_picker: "0.6.0+8"
path_provider: "0.4.1"
date_format: "1.0.5"
numberpicker: "0.1.7"
qr_mobile_vision: "0.2.2"
firebase_ml_vision: "0.8.0"
qr_flutter: "2.0.0+51"
flutter_native_image:
git: "https://github.com/btastic/flutter_native_image.git"
connectivity: "0.4.2"
firebase_messaging: "5.1.6"
package_info: "0.3.2+1"
share: "0.5.3"
url_launcher: "4.1.0+1"
flutter_walkthrough: ^0.0.1
country_pickers: "1.0.1"
shared_preferences: "0.4.3"
flutter_facebook_login: "2.0.1"
charts_flutter: "0.5.0"
device_info: "0.3.0"
http: "^0.11.3+16"
permission_handler: "3.0.0"
flutter_local_notifications: "0.6.0"
contacts_service: "^0.0.9"
flutter_dialogflow: "0.1.2"
#flutter_lottie: "0.2.0"
dev_dependencies:
build_runner: ^1.0.0
flutter_test:
sdk: flutter
Example errors: Failed to build iOS app Error output from Xcode build: ↳ ** BUILD FAILED ** Xcode's output: ↳ ios/Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererController.m:133:17: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self] _view.frame = CGRectMake(0.0, 0.0, CGRectGetWidth(_view.bounds), 0.0); ^ self-> /Volumes/ios/Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererController.m:133:67: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self] _view.frame = CGRectMake(0.0, 0.0, CGRectGetWidth(_view.bounds), 0.0);
8 warnings generated. /Users/flutter/.pub-cache/hosted/pub.dartlang.org/contacts_service-0.0.9/ios/Classes/ContactsServicePlugin.m:6:4: warning: 'SwiftContactsServicePlugin' is only available on iOS 9.0 or newer [-Wunguarded-availability] [SwiftContactsServicePlugin registerWithRegistrar:registrar];
duplicate symbol '_GMVDetectorTypeProduct' in: /Volumes/ios/Pods/FirebaseMLVision/Frameworks/FirebaseMLVision.framework/FirebaseMLVision(GMVDetector_c7138b42e3a094afed235ab051b2ff6c.o) /Volumes/ios/Pods/GoogleMobileVision/Detector/Frameworks/GoogleMobileVision.framework/GoogleMobileVision(GMVDetector_d8eaeedb32b9d25ce52bdf3b39f2008d.o)
ld: 106 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
Been on this for 1 week without resolution. Help appreciate very much!