firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.63k stars 3.95k forks source link

firebase_messaging unable build after null sound migrate 2.2 #6261

Closed fullflash closed 3 years ago

fullflash commented 3 years ago

Hi, after migrating to flutter null sound and version 2.2 getting ios build error.

`flutter doctor -v [✓] Flutter (Channel stable, 2.2.0, on Mac OS X 10.15.7 19H524 darwin-x64, locale en-TR) • Flutter version 2.2.0 at /Users/*****/SDK/flutter • Framework revision b22742018b (13 days ago), 2021-05-14 19:12:57 -0700 • Engine revision a9d88a4d18 • Dart version 2.13.0

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at /Users/*****/Library/Android/sdk • Platform android-30, build-tools 30.0.3 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 12.4, Build version 12D4e • CocoaPods version 1.10.1

[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.56.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.22.0

[✓] Connected device (2 available) • iPhone SE (2nd generation) (mobile) • 4A99C1C8-9ACA-447E-8F35-43BFF23A5BA7 • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator) • Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.77`

ld: warning: Could not find or use auto-linked framework 'Flutter'
Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_FlutterError", referenced from:
      objc-class-ref in firebase_core(FLTFirebasePlugin.o)
      objc-class-ref in firebase_dynamic_links(FLTFirebaseDynamicLinksPlugin.o)
      objc-class-ref in google_sign_in(FLTGoogleSignInPlugin.o)
      objc-class-ref in permission_handler(PermissionHandlerPlugin.o)
  "_OBJC_CLASS_$_FlutterMethodChannel", referenced from:
      objc-class-ref in firebase_analytics(FLTFirebaseAnalyticsPlugin.o)
      objc-class-ref in firebase_auth(FLTFirebaseAuthPlugin.o)
      objc-class-ref in firebase_core(FLTFirebaseCorePlugin.o)
      objc-class-ref in firebase_dynamic_links(FLTFirebaseDynamicLinksPlugin.o)
      objc-class-ref in firebase_messaging(FLTFirebaseMessagingPlugin.o)
      objc-class-ref in google_sign_in(FLTGoogleSignInPlugin.o)
      objc-class-ref in permission_handler(PermissionHandlerPlugin.o)
      ...
  "_OBJC_CLASS_$_FlutterEventChannel", referenced from:
      objc-class-ref in firebase_auth(FLTFirebaseAuthPlugin.o)
  "_FlutterMethodNotImplemented", referenced from:
      -[FLTFirebaseAnalyticsPlugin handleMethodCall:result:] in firebase_analytics(FLTFirebaseAnalyticsPlugin.o)
      -[FLTFirebaseAuthPlugin handleMethodCall:result:] in firebase_auth(FLTFirebaseAuthPlugin.o)
      -[FLTFirebaseCorePlugin handleMethodCall:result:] in firebase_core(FLTFirebaseCorePlugin.o)
      -[FLTFirebaseDynamicLinksPlugin handleMethodCall:result:] in firebase_dynamic_links(FLTFirebaseDynamicLinksPlugin.o)
      -[FLTFirebaseMessagingPlugin handleMethodCall:result:] in firebase_messaging(FLTFirebaseMessagingPlugin.o)
      -[FLTGoogleSignInPlugin handleMethodCall:result:] in google_sign_in(FLTGoogleSignInPlugin.o)
      -[PermissionHandlerPlugin handleMethodCall:result:] in permission_handler(PermissionHandlerPlugin.o)
      ...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
darshankawar commented 3 years ago

@fullflash Can you try flutter clean or flutter pub cache repair and then flutter run to see if it helps ?

fullflash commented 3 years ago

yes we tried all clean workaround commands. like

cd ios
pod deintegrate
cd ..
flutter channel stable
flutter upgrade
flutter clean
flutter build ios
lutter clean 2>&1 >/dev/null
echo Updating Pod...
pod repo update

#--verbose

{if ! ( "${PWD##*/}" == 'ios') 2>&1 >/dev/null
    then cd ios
fi} 2>&1 >/dev/null

echo Removing pod files...
rm -rf Podfile.lock Pods/ 2>&1 >/dev/null

cd ..

echo Removing cached flutter dependency files...
rm -rf pubspec.lock .packages .flutter-plugins 2>&1 >/dev/null

echo Repairing pub cache... uzun cekir
flutter pub pub cache repair

echo Getting all flutter packages...
flutter packages get

cd ios

echo Running pod install...
pod install
fullflash commented 3 years ago

upgraded with latest Xcode 12.5 still same error.

here is the podfile content

# Uncomment this line to define a global platform for your project
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
  pod 'GoogleUtilities'

  pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '8.0.0'
  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)
    target.build_configurations.each do |config|
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
          '$(inherited)',

          ## dart: PermissionGroup.calendar
          # 'PERMISSION_EVENTS=0',

          ## dart: PermissionGroup.reminders
          # 'PERMISSION_REMINDERS=0',

          ## dart: PermissionGroup.contacts
          # 'PERMISSION_CONTACTS=0',

          ## dart: PermissionGroup.camera
          'PERMISSION_CAMERA=0',

          ## dart: PermissionGroup.microphone
          # 'PERMISSION_MICROPHONE=0',

          ## dart: PermissionGroup.speech
          # 'PERMISSION_SPEECH_RECOGNIZER=0',

          ## dart: PermissionGroup.photos
          'PERMISSION_PHOTOS=0',

          ## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
          # 'PERMISSION_LOCATION=0',

          ## dart: PermissionGroup.notification
          'PERMISSION_NOTIFICATIONS=0',

          ## dart: PermissionGroup.mediaLibrary
          'PERMISSION_MEDIA_LIBRARY=0',

          ## dart: PermissionGroup.sensors
          # 'PERMISSION_SENSORS=0'
        ]
     end
  end
end

target 'ImageExtension' do
  pod 'GoogleUtilities'

  use_frameworks!
  pod 'Firebase/Messaging'
end
darshankawar commented 3 years ago

@fullflash Thanks for these details. Can you provide flutter pub deps -- --style=compact ? Maybe there could be some plugins that may not be compatible with nullsafety after you migrated and hence getting the linker error with the pods.

fullflash commented 3 years ago

thanks for assistance here are the pub deps logs

flutter pub deps -- --style=compact 
Changing current working directory to: 
Dart SDK 2.13.1
Flutter SDK 2.2.1

dependencies:
- core 0.15.2+112 [flutter_localizations rxdart camera http dio get_it provider font_awesome_flutter sqflite path_provider flutter_barcode_scanner qr_flutter barcode_widget cached_network_image flutter_cache_manager transparent_image permission_handler url_launcher flutter_swiper_null_safety image_picker image_cropper package_info flutter_sim_country_code pull_to_refresh auto_size_text device_info photo_view shared_preferences flutter_secure_storage badges firebase_core firebase_analytics firebase_auth google_sign_in flutter_login_facebook firebase_messaging firebase_dynamic_links the_apple_sign_in uni_links share app_settings launch_review intl country_icons sticky_and_expandable_list flutter_web_browser webview_flutter collection]
- cupertino_icons 1.0.3
- flutter 0.0.0 [characters collection meta typed_data vector_math sky_engine]
- flutter_localizations 0.0.0 [flutter intl characters clock collection meta path typed_data vector_math]

dev dependencies:
- flutter_launcher_icons 0.9.0 [args image path yaml]
- flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher meta source_span stream_channel string_scanner term_glyph typed_data]

transitive dependencies:
- app_settings 4.1.0 [flutter]
- archive 3.1.2 [crypto path]
- args 2.0.0
- async 2.6.1 [meta collection]
- auto_size_text 3.0.0-nullsafety.0 [flutter]
- badges 2.0.1 [flutter]
- barcode 2.1.0 [meta qr]
- barcode_widget 2.0.1 [barcode flutter]
- boolean_selector 2.1.0 [source_span string_scanner]
- cached_network_image 3.0.0 [flutter flutter_cache_manager octo_image]
- camera 0.8.1+1 [flutter camera_platform_interface pedantic quiver]
- camera_platform_interface 2.0.1 [flutter meta plugin_platform_interface cross_file stream_transform]
- characters 1.1.0
- charcode 1.2.0
- clock 1.1.0
- collection 1.15.0
- country_icons 2.0.2 [flutter]
- cross_file 0.3.1+1 [flutter meta]
- crypto 3.0.1 [collection typed_data]
- device_info 2.0.2 [flutter device_info_platform_interface]
- device_info_platform_interface 2.0.1 [flutter meta plugin_platform_interface]
- dio 4.0.0 [http_parser path]
- fake_async 1.2.0 [clock collection]
- ffi 1.1.1
- file 6.1.1 [meta path]
- firebase 9.0.1 [http http_parser js]
- firebase_analytics 8.1.0 [firebase_analytics_platform_interface firebase_analytics_web firebase_core flutter meta]
- firebase_analytics_platform_interface 2.0.1 [flutter meta]
- firebase_analytics_web 0.3.0+1 [firebase firebase_analytics_platform_interface flutter flutter_web_plugins meta]
- firebase_auth 1.2.0 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta]
- firebase_auth_platform_interface 4.2.3 [firebase_core flutter meta plugin_platform_interface]
- firebase_auth_web 1.1.3 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser intl js meta]
- firebase_core 1.2.0 [firebase_core_platform_interface firebase_core_web flutter meta]
- firebase_core_platform_interface 4.0.1 [collection flutter meta plugin_platform_interface]
- firebase_core_web 1.1.0 [firebase_core_platform_interface flutter flutter_web_plugins js meta]
- firebase_dynamic_links 2.0.4 [firebase_core flutter]
- firebase_messaging 10.0.0 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta]
- firebase_messaging_platform_interface 3.0.0 [firebase_core flutter meta plugin_platform_interface]
- firebase_messaging_web 2.0.0 [firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins js meta]
- flutter_barcode_scanner 2.0.0 [flutter flutter_plugin_android_lifecycle]
- flutter_blurhash 0.6.0 [flutter meta pedantic]
- flutter_cache_manager 3.1.0 [clock collection file flutter http image path path_provider pedantic rxdart sqflite uuid]
- flutter_login_facebook 1.0.1 [flutter list_ext]
- flutter_plugin_android_lifecycle 2.0.2 [flutter]
- flutter_secure_storage 4.2.0 [meta flutter]
- flutter_sim_country_code 0.1.0 [flutter]
- flutter_swiper_null_safety 1.0.2 [flutter]
- flutter_web_browser 0.13.1 [flutter]
- flutter_web_plugins 0.0.0 [flutter js characters collection meta typed_data vector_math]
- font_awesome_flutter 9.0.0 [flutter]
- get_it 7.1.3 [async collection]
- google_sign_in 5.0.4 [google_sign_in_platform_interface google_sign_in_web flutter meta]
- google_sign_in_platform_interface 2.0.1 [flutter meta quiver]
- google_sign_in_web 0.10.0 [google_sign_in_platform_interface flutter flutter_web_plugins meta js]
- http 0.13.3 [async http_parser meta path pedantic]
- http_parser 4.0.0 [charcode collection source_span string_scanner typed_data]
- image 3.0.2 [archive meta xml]
- image_cropper 1.4.0 [flutter]
- image_picker 0.7.5+3 [flutter flutter_plugin_android_lifecycle image_picker_platform_interface image_picker_for_web]
- image_picker_for_web 2.0.0 [image_picker_platform_interface meta flutter flutter_web_plugins]
- image_picker_platform_interface 2.1.0 [flutter meta http plugin_platform_interface]
- intl 0.17.0 [clock path]
- js 0.6.3
- launch_review 3.0.1 [flutter]
- list_ext 1.0.2 [quiver collection]
- matcher 0.12.10 [stack_trace]
- meta 1.3.0
- mime 1.0.0
- nested 1.0.0 [flutter]
- octo_image 1.0.0+1 [flutter flutter_blurhash]
- package_info 2.0.2 [flutter]
- path 1.8.0
- path_provider 2.0.2 [flutter path_provider_platform_interface path_provider_macos path_provider_linux path_provider_windows]
- path_provider_linux 2.0.0 [path xdg_directories path_provider_platform_interface flutter]
- path_provider_macos 2.0.0 [flutter]
- path_provider_platform_interface 2.0.1 [flutter meta platform plugin_platform_interface]
- path_provider_windows 2.0.1 [path_provider_platform_interface meta path flutter ffi win32]
- pedantic 1.11.0
- permission_handler 8.0.0+2 [flutter meta permission_handler_platform_interface]
- permission_handler_platform_interface 3.5.0 [flutter meta plugin_platform_interface]
- petitparser 4.1.0 [meta]
- photo_view 0.11.1 [flutter]
- platform 3.0.0
- plugin_platform_interface 2.0.0 [meta]
- process 4.2.1 [file path platform]
- provider 5.0.0 [collection flutter nested]
- pull_to_refresh 2.0.0 [flutter]
- qr 2.0.0 [meta]
- qr_flutter 4.0.0 [flutter qr]
- quiver 3.0.1 [matcher]
- rxdart 0.27.0
- share 2.0.4 [meta mime flutter]
- shared_preferences 2.0.6 [meta flutter shared_preferences_platform_interface shared_preferences_linux shared_preferences_macos shared_preferences_web shared_preferences_windows]
- shared_preferences_linux 2.0.0 [flutter file meta path path_provider_linux shared_preferences_platform_interface]
- shared_preferences_macos 2.0.0 [shared_preferences_platform_interface flutter]
- shared_preferences_platform_interface 2.0.0 [flutter]
- shared_preferences_web 2.0.0 [shared_preferences_platform_interface flutter flutter_web_plugins meta]
- shared_preferences_windows 2.0.0 [shared_preferences_platform_interface flutter file meta path path_provider_platform_interface path_provider_windows]
- sky_engine 0.0.99
- source_span 1.8.1 [collection path term_glyph]
- sqflite 2.0.0+3 [flutter sqflite_common path]
- sqflite_common 2.0.0+2 [synchronized path meta]
- stack_trace 1.10.0 [path]
- sticky_and_expandable_list 1.0.0-nullsafety.1 [flutter]
- stream_channel 2.1.0 [async]
- stream_transform 2.0.0
- string_scanner 1.1.0 [charcode source_span]
- synchronized 3.0.0
- term_glyph 1.2.0
- test_api 0.3.0 [async boolean_selector collection meta path source_span stack_trace stream_channel string_scanner term_glyph matcher]
- the_apple_sign_in 1.1.1 [flutter]
- transparent_image 2.0.0
- typed_data 1.3.0 [collection]
- uni_links 0.5.1 [flutter uni_links_platform_interface uni_links_web]
- uni_links_platform_interface 1.0.0 [flutter plugin_platform_interface]
- uni_links_web 0.1.0 [flutter flutter_web_plugins uni_links_platform_interface]
- url_launcher 6.0.4 [flutter url_launcher_platform_interface url_launcher_linux url_launcher_macos url_launcher_windows url_launcher_web]
- url_launcher_linux 2.0.0 [flutter]
- url_launcher_macos 2.0.0 [flutter]
- url_launcher_platform_interface 2.0.3 [flutter plugin_platform_interface]
- url_launcher_web 2.0.0 [url_launcher_platform_interface meta flutter flutter_web_plugins]
- url_launcher_windows 2.0.0 [flutter]
- uuid 3.0.4 [crypto]
- vector_math 2.1.0
- webview_flutter 1.0.7 [flutter]
- win32 2.1.1 [ffi]
- xdg_directories 0.2.0 [meta path process]
- xml 5.1.1 [collection meta petitparser]
- yaml 3.1.0 [collection source_span string_scanner]
darshankawar commented 3 years ago

@fullflash It may not be specific to firebase_messaging or any firebase plugin. If you try to remove these plugins and try again, you may get this error for some other plugin. May be an issue in Xcode project files are not getting updated.

You may try to delete the derivedData folder and see if it helps.

fullflash commented 3 years ago

already did rm -rf ~/Library/Developer/Xcode/DerivedData still getting same error. there is no information why xcode unable to find flutter framework.

markusaksli-nc commented 3 years ago

Are you using the correct build target and including the right archs?

Based on ld: symbol(s) not found for architecture x86_64 and the fact that you are building on an ARM host it looks like there is a mismatch of archs here.

EhabSalah commented 3 years ago

Facing the very similar issue, here it is https://github.com/FirebaseExtended/flutterfire/issues/6335

fullflash commented 3 years ago

i did not found any solution. create a new xcode project and did manually all configs. dont waste your time trying to find a solution it is xcode fetish ) just delete and recreate new project )

mattbonnell commented 3 years ago

@fullflash when you say create a new xcode project, did you just wipe your ios/ directory?