0

I'm trying to compile a flutter app using Android Studio on Mac OS X 11.6, but every time I try to build it (flutter run, flutter build, or clicking play on Android Studio), it fails with the following error:

Undefined symbols for architecture arm64:
      "_OBJC_CLASS_$_GeneratedPluginRegistrant", referenced from:
          objc-class-ref in AppDelegate.o
    ld: symbol(s) not found for architecture arm64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

Complete output:

Launching lib/main.dart on iPhone di Davide in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: LQG2YHC5SZ
Running pod install...
Running Xcode build...
Xcode build done.                                           22,0s
Failed to build iOS app
Error output from Xcode build:
↳
    --- xcodebuild: WARNING: Using the first of multiple matching destinations:
    { platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device }
    { platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Any iOS Simulator Device }
    { platform:iOS Simulator, id:BE54F8A2-BD8F-4CD5-9212-D72B7719769B, OS:15.0, name:iPad (9th generation) }
    { platform:iOS Simulator, id:2332D930-C440-4A31-9970-06F2387005AC, OS:15.0, name:iPad Air (4th generation) }
    { platform:iOS Simulator, id:ACF9EBDD-460D-4093-8156-506F074EF25E, OS:15.0, name:iPad Pro (9.7-inch) }
    { platform:iOS Simulator, id:2BB1096E-AA09-44E1-B0D8-245A13552C02, OS:15.0, name:iPad Pro (11-inch) (3rd generation) }
    { platform:iOS Simulator, id:E262608F-4783-4B80-82E4-437F796BE75D, OS:15.0, name:iPad Pro (12.9-inch) (5th generation) }
    { platform:iOS Simulator, id:AD622E26-8A6B-4BAA-90C4-741876C14F69, OS:15.0, name:iPad mini (6th generation) }
    { platform:iOS Simulator, id:432E4F62-B715-4506-90C0-2C36D63428B5, OS:15.0, name:iPhone 8 }
    { platform:iOS Simulator, id:037CA7CC-3980-4D3B-803B-2B48AEFA9B7E, OS:15.0, name:iPhone 8 Plus }
    { platform:iOS Simulator, id:15C0EBCB-4082-46DB-B86C-33B5631CE39E, OS:15.0, name:iPhone 11 }
    { platform:iOS Simulator, id:0E42F177-D20C-462A-BC33-6D1BDE033FB2, OS:15.0, name:iPhone 11 Pro }
    { platform:iOS Simulator, id:8FDAAB06-742D-4796-9B7E-2D1CAE4A35A2, OS:15.0, name:iPhone 11 Pro Max }
    { platform:iOS Simulator, id:0B4E077C-D470-4404-B1AA-68239332B640, OS:15.0, name:iPhone 12 }
    { platform:iOS Simulator, id:20BDB2FE-C3C2-42D9-9FB6-069FEA80F38C, OS:15.0, name:iPhone 12 Pro }
    { platform:iOS Simulator, id:8F92CC28-DDCF-49E6-A4C0-737B14806016, OS:15.0, name:iPhone 12 Pro Max }
    { platform:iOS Simulator, id:9ED58FD5-19A1-42CA-85D5-206A040B08B1, OS:15.0, name:iPhone 12 mini }
    { platform:iOS Simulator, id:DBF3C639-9FD2-467F-B4B6-6B274A87D312, OS:15.0, name:iPhone 13 }
    { platform:iOS Simulator, id:C6D578DB-ECDC-4DD5-8A9E-E81B05C0A953, OS:15.0, name:iPhone 13 Pro }
    { platform:iOS Simulator, id:16BC4610-FA74-4E9C-84DD-FC8539F9C8B6, OS:15.0, name:iPhone 13 Pro Max }
    { platform:iOS Simulator, id:CF385D9F-3D94-441A-9978-B49F125F19BE, OS:15.0, name:iPhone 13 mini }
    { platform:iOS Simulator, id:D6888F4C-9806-425A-84B6-A4FCE23B8298, OS:15.0, name:iPhone SE (2nd generation) }
    { platform:iOS Simulator, id:0420E3E7-8229-4D8B-A5F5-6813DC478F9D, OS:15.0, name:iPod touch (7th generation) }
    ** BUILD FAILED **


Xcode's output:
↳
    /Users/dado/Development/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.8.4+3/ios/Classes/FLTPHPickerSaveImageToPathOperation.m:110:19: warning: 'requestImageDataForAsset:options:resultHandler:' is deprecated: first deprecated in iOS 13 [-Wdeprecated-declarations]
                      requestImageDataForAsset:originalAsset
                      ^~~~~~~~~~~~~~~~~~~~~~~~
                      requestImageDataAndOrientationForAsset
    In module 'Photos' imported from /Users/dado/Development/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.8.4+3/ios/Classes/FLTImagePickerPhotoAssetUtil.h:6:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/System/Library/Frameworks/Photos.framework/Headers/PHImageManager.h:162:1: note: 'requestImageDataForAsset:options:resultHandler:' has been explicitly marked deprecated here
    - (PHImageRequestID)requestImageDataForAsset:(PHAsset *)asset options:(nullable PHImageRequestOptions *)options resultHandler:(void (^)(NSData *_Nullable imageData, NSString *_Nullable dataUTI, UIImageOrientation orientation, NSDictionary *_Nullable info))resultHandler API_DEPRECATED_WITH_REPLACEMENT("-requestImageDataAndOrientationForAsset:options:resultHandler:", ios(8, 13), tvos(8, 13)) API_UNAVAILABLE(macos);
    ^
    1 warning generated.
    /Users/dado/Development/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.8.4+3/ios/Classes/FLTImagePickerImageUtil.m:120:71: warning: 'kUTTypeGIF' is deprecated: first deprecated in iOS 15.0 - Use UTTypeGIF instead. [-Wdeprecated-declarations]
      options[(NSString *)kCGImageSourceTypeIdentifierHint] = (NSString *)kUTTypeGIF;
                                                                          ^
    In module 'MobileCoreServices' imported from /Users/dado/Development/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.8.4+3/ios/Classes/FLTImagePickerImageUtil.m:6:
    In module 'CoreServices' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/System/Library/Frameworks/MobileCoreServices.framework/Headers/MobileCoreServices.h:9:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/System/Library/Frameworks/CoreServices.framework/Headers/UTCoreTypes.h:728:26: note: 'kUTTypeGIF' has been explicitly marked deprecated here
    extern const CFStringRef kUTTypeGIF                                  API_DEPRECATED("Use UTTypeGIF instead.", ios(3.0, 15.0), macos(10.4, 12.0), tvos(9.0, 15.0), watchos(1.0, 8.0));
                             ^
    1 warning generated.
    3 warnings generated.
    7 warnings generated.
    /Users/dado/Development/flutter/.pub-cache/hosted/pub.dartlang.org/camera-0.9.4+3/ios/Classes/CameraPlugin.m:52:1: warning: implementing deprecated method [-Wdeprecated-implementations]
    - (void)captureOutput:(AVCapturePhotoOutput *)output
    ^
    In module 'AVFoundation' imported from /Users/dado/Development/flutter/.pub-cache/hosted/pub.dartlang.org/camera-0.9.4+3/ios/Classes/CameraPlugin.m:8:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVCapturePhotoOutput.h:756:1: note: method 'captureOutput:didFinishProcessingPhotoSampleBuffer:previewPhotoSampleBuffer:resolvedSettings:bracketSettings:error:' declared here
    - (void)captureOutput:(AVCapturePhotoOutput *)output didFinishProcessingPhotoSampleBuffer:(nullable CMSampleBufferRef)photoSampleBuffer previewPhotoSampleBuffer:(nullable CMSampleBufferRef)previewPhotoSampleBuffer resolvedSettings:(AVCaptureResolvedPhotoSettings *)resolvedSettings bracketSettings:(nullable AVCaptureBracketedStillImageSettings *)bracketSettings error:(nullable NSError *)error API_DEPRECATED_WITH_REPLACEMENT("-captureOutput:didFinishProcessingPhoto:error:", ios(10.0, 11.0)) API_UNAVAILABLE(macos) API_UNAVAILABLE(tvos);
    ^
    /Users/dado/Development/flutter/.pub-cache/hosted/pub.dartlang.org/camera-0.9.4+3/ios/Classes/CameraPlugin.m:65:7: warning: 'JPEGPhotoDataRepresentationForJPEGSampleBuffer:previewPhotoSampleBuffer:' is deprecated: first deprecated in iOS 11.0 [-Wdeprecated-declarations]
          JPEGPhotoDataRepresentationForJPEGSampleBuffer:photoSampleBuffer
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          -[AVCapturePhoto fileDataRepresentation]
    In module 'AVFoundation' imported from /Users/dado/Development/flutter/.pub-cache/hosted/pub.dartlang.org/camera-0.9.4+3/ios/Classes/CameraPlugin.m:8:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVCapturePhotoOutput.h:546:1: note: 'JPEGPhotoDataRepresentationForJPEGSampleBuffer:previewPhotoSampleBuffer:' has been explicitly marked deprecated here
    + (nullable NSData *)JPEGPhotoDataRepresentationForJPEGSampleBuffer:(CMSampleBufferRef)JPEGSampleBuffer previewPhotoSampleBuffer:(nullable CMSampleBufferRef)previewPhotoSampleBuffer API_DEPRECATED_WITH_REPLACEMENT("-[AVCapturePhoto fileDataRepresentation]", ios(10.0, 11.0)) API_UNAVAILABLE(macos) API_UNAVAILABLE(tvos);
    ^
    /Users/dado/Development/flutter/.pub-cache/hosted/pub.dartlang.org/camera-0.9.4+3/ios/Classes/CameraPlugin.m:592:13: warning: 'OSAtomicCompareAndSwapPtrBarrier' is deprecated: first deprecated in iOS 10.0 - Use atomic_compare_exchange_strong() from <stdatomic.h> instead [-Wdeprecated-declarations]
        while (!OSAtomicCompareAndSwapPtrBarrier(old, newBuffer, (void **)&_latestPixelBuffer)) {
                ^
    In module 'Darwin' imported from /Users/dado/Development/flutter/.pub-cache/hosted/pub.dartlang.org/camera-0.9.4+3/ios/Classes/CameraPlugin.m:11:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/usr/include/libkern/OSAtomicDeprecated.h:548:6: note: 'OSAtomicCompareAndSwapPtrBarrier' has been explicitly marked deprecated here
    bool    OSAtomicCompareAndSwapPtrBarrier( void *__oldValue, void *__newValue, void * volatile *__theValue );
            ^
    /Users/dado/Development/flutter/.pub-cache/hosted/pub.dartlang.org/camera-0.9.4+3/ios/Classes/CameraPlugin.m:807:11: warning: 'OSAtomicCompareAndSwapPtrBarrier' is deprecated: first deprecated in iOS 10.0 - Use atomic_compare_exchange_strong() from <stdatomic.h> instead [-Wdeprecated-declarations]
      while (!OSAtomicCompareAndSwapPtrBarrier(pixelBuffer, nil, (void **)&_latestPixelBuffer)) {
              ^
    In module 'Darwin' imported from /Users/dado/Development/flutter/.pub-cache/hosted/pub.dartlang.org/camera-0.9.4+3/ios/Classes/CameraPlugin.m:11:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/usr/include/libkern/OSAtomicDeprecated.h:548:6: note: 'OSAtomicCompareAndSwapPtrBarrier' has been explicitly marked deprecated here
    bool    OSAtomicCompareAndSwapPtrBarrier( void *__oldValue, void *__newValue, void * volatile *__theValue );
            ^
    4 warnings generated.
    Undefined symbols for architecture arm64:
      "_OBJC_CLASS_$_GeneratedPluginRegistrant", referenced from:
          objc-class-ref in AppDelegate.o
    ld: symbol(s) not found for architecture arm64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in parallel

Could not build the precompiled application for the device.

Error launching application on iPhone di Davide.

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 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)
    target.build_configurations.each do |config|
      config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
    end   end end

pubspec.yaml

name: app_name
description: generic description


# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1

environment:
  sdk: ">=2.12.0 <3.0.0"

# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
  http:
  encrypt:
  flutter:
    sdk: flutter
  flutter_slidable: 
  camera:
  image_picker:
  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.2

dev_dependencies:
  flutter_test:
    sdk: flutter

  # The "flutter_lints" package below contains a set of recommended lints to
  # encourage good coding practices. The lint set provided by the package is
  # activated in the `analysis_options.yaml` file located at the root of your
  # package. See that file for information about deactivating specific lint
  # rules and activating additional ones.
  flutter_lints: ^1.0.0

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:
  assets:
    - assets/
    - assets/Images/


  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  # assets:
  #   - images/a_dot_burr.jpeg
  #   - images/a_dot_ham.jpeg

  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware.

  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages

  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  # fonts:
  #   - family: Schyler
  #     fonts:
  #       - asset: fonts/Schyler-Regular.ttf
  #       - asset: fonts/Schyler-Italic.ttf
  #         style: italic
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages

This is what I've tried:

  • flutter clean
  • reistalling Android Studio / Flutter / Cocoapods
  • following this and this
  • deleting the whole iOS folder
  • deleting the build folder

0 Answers0