Encountered error while building for device

I tried to run my app with flutter build ios and I got this message Encountered error while building for device. I have tried: flutter clean && rm ios/Podfile ios/Podfile.lock pubspec.loc...

I tried to run my app with flutter build ios and I got this message Encountered error while building for device.

I have tried:
flutter clean && rm ios/Podfile ios/Podfile.lock pubspec.lock && rm -rf ios/Pods ios/Runner.xcworkspace && flutter build iOS

But still got the same error

Expected results:

I want my app to run on the simulator

Actual results:

Logs

flutter run

Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    /Users/abdullahhamadi/Development/tools/flutter/.pub-cache/hosted/pub.dartlang.org/permission_
    handler-5.0.1+2/ios/Classes/strategies/PhonePermissionStrategy.m:43:34: error: no visible
    @interface for 'NSDictionary<NSString *,CTCarrier *>' declares the selector
    'mobileNetworkCode'
            NSString *mnc = [carrier mobileNetworkCode];
                             ~~~~~~~ ^~~~~~~~~~~~~~~~~
    /Users/abdullahhamadi/Development/tools/flutter/.pub-cache/hosted/pub.dartlang.org/permission_
    handler-5.0.1+2/ios/Classes/strategies/PhonePermissionStrategy.m:43:19: warning: unused
    variable 'mnc' [-Wunused-variable]
            NSString *mnc = [carrier mobileNetworkCode];
                      ^
    /Users/abdullahhamadi/Development/tools/flutter/.pub-cache/hosted/pub.dartlang.org/permission_
    handler-5.0.1+2/ios/Classes/strategies/PhonePermissionStrategy.m:47:11: error: use of
    undeclared identifier 'mnc'
        if (([mnc length] == 0) || ([mnc isEqualToString:@"65535"])) {
              ^
    /Users/abdullahhamadi/Development/tools/flutter/.pub-cache/hosted/pub.dartlang.org/permission_
    handler-5.0.1+2/ios/Classes/strategies/PhonePermissionStrategy.m:47:34: error: use of
    undeclared identifier 'mnc'
        if (([mnc length] == 0) || ([mnc isEqualToString:@"65535"])) {
                                     ^
    1 warning and 3 errors generated.
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Analyzing workspace
    note: Constructing build description
    note: Build preparation complete

Could not build the application for the simulator.
Error launching application on iPhone 12 Pro Max.

Podfile

# Uncomment this line to define a global platform for your project
platform :ios, '10.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|
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
    end
    flutter_additional_ios_build_settings(target)
  end
end

flutter doctor -v

[✓] Flutter (Channel stable, 2.0.6, on macOS 11.5.2 20G95 darwin-x64, locale en-US)
    • Flutter version 2.0.6 at /Users/abdullahhamadi/Development/tools/flutter
    • Framework revision 1d9032c7e1 (4 months ago), 2021-04-29 17:37:58 -0700
    • Engine revision 05e680e202
    • Dart version 2.12.3

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/abdullahhamadi/Library/Android/sdk
    • Platform android-30, build-tools 30.0.2
    • ANDROID_HOME = /Users/abdullahhamadi/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5.1, Build version 12E507
    • CocoaPods version 1.10.2

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

[✓] Android Studio (version 2020.3)
    • 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 11.0.10+0-b96-7281165)

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

[✓] Connected device (2 available)
    • iPhone 12 Pro Max (mobile) • 855D4BBB-13EA-483F-9F15-D55DE7053774 • ios            •
      com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
    • Chrome (web)               • chrome                               • web-javascript • Google
      Chrome 92.0.4515.159

• No issues found!

verbose log.txt

#ios #xcode #flutter #ios4

Вопрос:

Эта ошибка новая, все работало до пары дней. Я перепробовал все решения в Интернете, но ничего не работает, и ошибка не является описательной.

У меня есть Xcode: 12.5.1 Mac Big Sur: 11.5.2

Я тоже сделал это:

  • Папка удаленных модулей внутри каталога ios
  • Удалил файл подкачки.блокировка файла внутри каталога ios
  • cd ios
  • установка модуля
  • обновление модуля
  • компакт-диск..
  • порхание чистое
  • флаттер паб получить
  • flutter сборка ios-релиз

Зависимости являются:

 environment:
  sdk: ">=2.12.0 <3.0.0"

dependencies:
  credit_card_type_detector: ^2.0.0
  cupertino_icons: ^1.0.2
  date_time_picker: "^2.1.0"
  flutter:
    sdk: flutter
  flutter_google_places: ^0.3.0
  flutter_native_splash: ^1.2.1
  flutter_stripe: ^1.2.0
  flutter_vibrate: ^1.1.0
  get: ^4.3.0
  get_storage: ^2.0.3
  http: ^0.13.3
  intl: ^0.17.0
  intl_phone_number_input: ^0.7.0 2
  pay: ^1.0.5
  pinput: ^1.2.0
  url_launcher: ^6.0.9
  
dev_dependencies:
  flutter_driver:
    sdk: flutter
  flutter_launcher_icons: "^0.9.0"
  flutter_test:
    sdk: flutter
  lint: ^1.0.0
  test: ^1.16.8
 

Ниже приведены журналы выполнения flutter build ios команды.

 Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    /Users/rey/src/sponges/sponges-client-app/ios/Pods/libPhoneNumber-iOS/libPhoneNumber/NBPhoneNumberUtil.m:3482:51:
    warning: 'subscriberCellularProvider' is deprecated: first deprecated in iOS 12.0 [-Wdeprecated-declarations]
      NSString *isoCode = [[self.telephonyNetworkInfo subscriberCellularProvider] isoCountryCode];
                                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
                                                      serviceSubscriberCellularProviders
    In module 'CoreTelephony' imported from
    /Users/rey/src/sponges/sponges-client-app/ios/Pods/libPhoneNumber-iOS/libPhoneNumber/NBPhoneNumberUtil.m:20:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.5.sdk/System/Library
    /Frameworks/CoreTelephony.framework/Headers/CTTelephonyNetworkInfo.h:112:50: note: property
    'subscriberCellularProvider' is declared deprecated here
    @property(readonly, retain, nullable) CTCarrier *subscriberCellularProvider
    API_DEPRECATED_WITH_REPLACEMENT("serviceSubscriberCellularProviders", ios(4.0, 12.0)) API_UNAVAILABLE(macos);
                                                     ^
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.5.sdk/System/Library
    /Frameworks/CoreTelephony.framework/Headers/CTTelephonyNetworkInfo.h:112:50: note: 'subscriberCellularProvider' has
    been explicitly marked deprecated here
    1 warning generated.
    /Users/rey/src/sponges/sponges-client-app/ios/Pods/Stripe/Stripe3DS2/Stripe3DS2/STDSSecTypeUtilities.m:133:21:
    warning: 'SecCertificateCopyPublicKey' is deprecated: first deprecated in iOS 12.0 [-Wdeprecated-declarations]
            publicKey = SecCertificateCopyPublicKey(certificate);
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
                        SecCertificateCopyKey
    In module 'Security' imported from
    /Users/rey/src/sponges/sponges-client-app/ios/Pods/Stripe/Stripe3DS2/Stripe3DS2/STDSSecTypeUtilities.m:13:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.5.sdk/System/Library
    /Frameworks/Security.framework/Headers/SecCertificate.h:174:11: note: 'SecCertificateCopyPublicKey' has been
    explicitly marked deprecated here
    SecKeyRef SecCertificateCopyPublicKey(SecCertificateRef certificate)
              ^
    1 warning generated.
    /Users/rey/Development/flutter/.pub-cache/hosted/pub.dartlang.org/stripe_ios-1.2.0/ios/Classes/CardFieldView.swift:31
    0:21: warning: expression implicitly coerced from '[String : Any?]' to '[String : Any]'
           onCardChange(cardData)
                        ^~~~~~~~
    /Users/rey/Development/flutter/.pub-cache/hosted/pub.dartlang.org/stripe_ios-1.2.0/ios/Classes/CardFieldView.swift:31
    0:21: note: explicitly cast to '[String : Any]' with 'as [String : Any]' to silence this warning
           onCardChange(cardData)
                        ^~~~~~~~
                                 as [String : Any]
    /Users/rey/Development/flutter/.pub-cache/hosted/pub.dartlang.org/stripe_ios-1.2.0/ios/Classes/Mappers.swift:371:25:
    warning: expression implicitly coerced from 'String?' to 'Any'
                    "type": mapFromPaymentIntentLastPaymentErrorType(lastPaymentError.type),
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/rey/Development/flutter/.pub-cache/hosted/pub.dartlang.org/stripe_ios-1.2.0/ios/Classes/Mappers.swift:371:25:
    note: provide a default value to avoid this warning
                    "type": mapFromPaymentIntentLastPaymentErrorType(lastPaymentError.type),
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                                            ?? <#default value#>
    /Users/rey/Development/flutter/.pub-cache/hosted/pub.dartlang.org/stripe_ios-1.2.0/ios/Classes/Mappers.swift:371:25:
    note: force-unwrap the value to avoid this warning
                    "type": mapFromPaymentIntentLastPaymentErrorType(lastPaymentError.type),
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                                           !
    /Users/rey/Development/flutter/.pub-cache/hosted/pub.dartlang.org/stripe_ios-1.2.0/ios/Classes/Mappers.swift:371:25:
    note: explicitly cast to 'Any' with 'as Any' to silence this warning
                    "type": mapFromPaymentIntentLastPaymentErrorType(lastPaymentError.type),
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                                            as Any
    /Users/rey/Development/flutter/.pub-cache/hosted/pub.dartlang.org/stripe_ios-1.2.0/ios/Classes/StripeSdk.swift:214:77
    : warning: conditional downcast from 'CardFieldViewFactory?' to 'CardFieldManager' is equivalent to an implicit
    conversion to an optional 'CardFieldManager'
            let cardFieldUIManager = bridge.module(forName: "CardFieldManager") as? CardFieldManager
                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~

    /Users/rey/Development/flutter/.pub-cache/hosted/pub.dartlang.org/stripe_ios-1.2.0/ios/Classes/StripeSdk.swift:453:77
    : warning: conditional downcast from 'CardFieldViewFactory?' to 'CardFieldManager' is equivalent to an implicit
    conversion to an optional 'CardFieldManager'
            let cardFieldUIManager = bridge.module(forName: "CardFieldManager") as? CardFieldManager
                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~

    /Users/rey/Development/flutter/.pub-cache/hosted/pub.dartlang.org/stripe_ios-1.2.0/ios/Classes/StripeSdk.swift:498:77
    : warning: conditional downcast from 'CardFieldViewFactory?' to 'CardFieldManager' is equivalent to an implicit
    conversion to an optional 'CardFieldManager'
            let cardFieldUIManager = bridge.module(forName: "CardFieldManager") as? CardFieldManager
                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~

    /Users/rey/Development/flutter/.pub-cache/hosted/pub.dartlang.org/stripe_ios-1.2.0/ios/Classes/StripeSdk.swift:565:77
    : warning: conditional downcast from 'CardFieldViewFactory?' to 'CardFieldManager' is equivalent to an implicit
    conversion to an optional 'CardFieldManager'
            let cardFieldUIManager = bridge.module(forName: "CardFieldManager") as? CardFieldManager
                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~


    Command PhaseScriptExecution failed with a nonzero exit code
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Analyzing workspace
    note: Constructing build description
    note: Build preparation complete

Encountered error while building for device.

 

Комментарии:

1. Проверьте свои этапы сборки, кажется, вы добавили несколько пользовательских сценариев, я прав?

2. @YauhenSampir единственные скрипты-это: /bin/sh «$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh» постройте

Я обновился до бета-версии Xcode 12.3. версия устройства 14.2, но Xcode жалуется:

Errors were encountered while preparing your device for development. Please check the Devices and Simulators Window.

Failed to prepare device for development

IPhone напрямую подключен к MacBook. Я перепробовал все болтовни в сети. но успеха нет?

enter image description here

2 ответа

Лучший ответ

Спасибо, Мэтту за подсказку: Обновление устройства iOS до 12.3 beta устранило проблему.

Если вы обновите iOS до последней бета-версии, вы также ДОЛЖНЫ использовать последнюю бета-версию Xcode.


0

Hashem Aboonajmi
1 Дек 2020 в 08:52

Точно такая же проблема здесь, это решило мне проблему:

  • Удалить приложение с телефона
  • Cmd + shift + K -> папка чистой сборки
  • Удалить производные данные
  • Отменить сопряжение устройства (из окна cmd + shift + 2)
  • Отключить телефон
  • Перезагрузить телефон
  • Перезагрузите Mac
  • Доверять

После этого сработало мв


0

Bence Pattogato
1 Дек 2020 в 10:05

The app is running on simulator correctly, but when I try to get the IOS Archive, it’s give me a «Build Failled»

total size is 55992877  speedup is 1.00
building file list ... done
Flutter.framework/
Flutter.framework/Flutter
Flutter.framework/Info.plist
Flutter.framework/icudtl.dat
Flutter.framework/_CodeSignature/
Flutter.framework/_CodeSignature/CodeResources

sent 426581217 bytes  received 120 bytes  170632534.80 bytes/sec
total size is 426528750  speedup is 1.00
/Volumes/Datas/Fasty/flutter_application/build/ios/Release-iphoneos/Runner.app/Frameworks/App.framework/App:

errSecInternalComponent
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
warning: Provisioning profile «iOS Team Provisioning Profile: com.akasolutions.fasty» for «Runner» contains entitlements that aren’t
in the entitlements
file: com.apple.developer.associated-domains.mdm-managed. To use these entitlements, add them to your entitlements file. Otherwise,
remove unused
entitlements from your provisioning profile. (in target ‘Runner’ from project ‘Runner’)

Encountered error while building for device.

Best Regards

Jonathan Hall's user avatar

Jonathan Hall

72.1k15 gold badges139 silver badges182 bronze badges

asked Jan 22, 2021 at 15:39

Bakhouche Akram's user avatar

Bakhouche AkramBakhouche Akram

962 gold badges3 silver badges15 bronze badges

[RESOLED]

I removed all keys/certs from keychain acces after reinsert it.
It solved my problem.

answered Jan 31, 2021 at 18:48

Bakhouche Akram's user avatar

Bakhouche AkramBakhouche Akram

962 gold badges3 silver badges15 bronze badges

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Encountered error during federation passive request
  • Encountered an improper argument ошибка как исправить
  • Encountered an error retrying in 3s krnl
  • Encountered an error pixiv
  • Encountered an error kernel

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии