无法为模拟器构建应用程序

Posted

技术标签:

【中文标题】无法为模拟器构建应用程序【英文标题】:Could not build application for the simulator 【发布时间】:2021-01-18 01:05:18 【问题描述】:
Launching lib/main.dart on iPhone 11 in debug mode...
 
Running pod install...                                             17.9s
Running Xcode build...                                                  
                                                   
 └─Compiling, linking and signing...                        14.2s
Xcode build done.                                           185.2s
Failed to build ios app
Error output from Xcode build:
↳
    2020-10-02 15:52:17.790 XCBBuildService[92468:463272] Failed to remove:
    /Users/gopichand/Library/Developer/Xcode/DerivedData/Runner-dfeoyynhjaxtdubsjwlrommeqqhn/Build/Interm
    ediates.noindex/XCBuildData/9bd14026a93f0e29dacb54f223c51718-manifest.xcbuild:
    unlink(/Users/gopichand/Library/Developer/Xcode/DerivedData/Runner-dfeoyynhjaxtdubsjwlrommeqqhn/Build
    /Intermediates.noindex/XCBuildData/9bd14026a93f0e29dacb54f223c51718-manifest.xcbuild): No such file
    or directory (2)
    2020-10-02 15:52:18.047 XCBBuildService[92468:463272] Failed to remove:
    /Users/gopichand/Library/Developer/Xcode/DerivedData/Runner-dfeoyynhjaxtdubsjwlrommeqqhn/Build/Interm
    ediates.noindex/XCBuildData/9bd14026a93f0e29dacb54f223c51718-desc.xcbuild:
    unlink(/Users/gopichand/Library/Developer/Xcode/DerivedData/Runner-dfeoyynhjaxtdubsjwlrommeqqhn/Build
    /Intermediates.noindex/XCBuildData/9bd14026a93f0e29dacb54f223c51718-desc.xcbuild): No such file or
    directory (2)
    2020-10-02 15:52:37.865 xcodebuild[92464:463031] [MT] iPhoneConnect: ????<DVTiOSDevice
    (0x7fe0f33c4a10), Gopichand’s iPhone, iPhone, 14.0.1 (18A393),
    2daa4ce564d608bd832f0403d6f1a9fbc473c1bf> == Underlying device preparation errors ==
    2020-10-02 15:52:37.866 xcodebuild[92464:463031] [MT] iPhoneConnect: Failed
    _shouldMakeReadyForDevelopment check even though device is not locked by passcode.
    Domain: com.apple.platform.iphoneos
    Code: 5
    Failure Reason: allowsSecureServices: 1. isConnected: 0. Platform:
    <DVTPlatform:0x7fe0ee426720:'com.apple.platform.iphoneos':<DVTFilePath:0x7fe0ee426570:'/Applications/
    Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform'>>. DTDKDeviceIdentifierIsIDID: 0
    User Info: 
        DVTDeviceDescription = "\Ud83d\Udcf1<DVTiOSDevice (0x7fe0f33c4a10), Gopichand\U2019s iPhone,
        iPhone, 14.0.1 (18A393), 2daa4ce564d608bd832f0403d6f1a9fbc473c1bf>";
    
    --
    2020-10-02 15:52:37.866 xcodebuild[92464:463031] [MT] iPhoneConnect: ????<DVTiOSDevice
    (0x7fe0f33c4a10), Gopichand’s iPhone, iPhone, 14.0.1 (18A393),
    2daa4ce564d608bd832f0403d6f1a9fbc473c1bf> == END: Underlying device preparation errors ==
    ** BUILD FAILED **

Xcode 的输出:

↳
    2020-10-02 15:55:08.619 ibtoold[96891:470853] DEBUG: Added to environment: 
        TMPDIR = "/var/folders/ff/r5npj56s077bhcklrn7rxdhh0000gn/T/2274EF74-2261-4AF6-B812-D36B73551C62";
    
    /* com.apple.actool.document.warnings */
    /Users/gopichand/Downloads/srm-updatedlogo-getstarted/ios/Runner/Assets.xcassets:./AppIcon.appiconset
    : warning: A 76x76@2x app icon is required for iPad apps targeting iOS 7.0 and later
    /Users/gopichand/Downloads/srm-updatedlogo-getstarted/ios/Runner/Assets.xcassets:./AppIcon.appiconset
    : warning: A 83.5x83.5@2x app icon is required for iPad apps targeting iOS 9.0 and later
    /* com.apple.actool.document.notices */
    /Users/gopichand/Downloads/srm-updatedlogo-getstarted/ios/Runner/Assets.xcassets:./AppIcon.appiconset
    /[][iphone][57x57][][][1x][][]: notice: 57x57 app icons only apply to iPhone apps targeting releases
    of iOS prior to 7.0
    /Users/gopichand/Downloads/srm-updatedlogo-getstarted/ios/Runner/Assets.xcassets:./AppIcon.appiconset
    /[][iphone][57x57][][][2x][][]: notice: 57x57@2x app icons only apply to iPhone apps targeting
    releases of iOS prior to 7.0
    /* com.apple.actool.compilation-results */
    /Users/gopichand/Downloads/srm-updatedlogo-getstarted/build/ios/Debug-iphonesimulator/Runner.app/AppI
    con60x60@2x.png
    /Users/gopichand/Downloads/srm-updatedlogo-getstarted/build/ios/Debug-iphonesimulator/Runner.app/Asse
    ts.car
    /Users/gopichand/Library/Developer/Xcode/DerivedData/Runner-dfeoyynhjaxtdubsjwlrommeqqhn/Build/Interm
    ediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/assetcatalog_generated_info.plist

    /Users/gopichand/Library/Developer/Xcode/DerivedData/Runner-dfeoyynhjaxtdubsjwlrommeqqhn/Build/Interm
    ediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/Script-77954228A945D3139096F339.sh:
    line 2: /Users/gopichand/Downloads/srm-updatedlogo-getstarted/ios/Pods/Target Support
    Files/Pods-Runner/Pods-Runner-frameworks.sh: Permission denied
    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: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the
    range of supported deployment target versions is 9.0 to 14.0.99. (in target 'GTMSessionFetcher' from
    project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the
    range of supported deployment target versions is 9.0 to 14.0.99. (in target 'FirebaseCore' from
    project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the
    range of supported deployment target versions is 9.0 to 14.0.99. (in target 'FirebaseCoreDiagnostics'
    from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the
    range of supported deployment target versions is 9.0 to 14.0.99. (in target 'FirebaseAuth' from
    project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the
    range of supported deployment target versions is 9.0 to 14.0.99. (in target 'FirebaseFirestore' from
    project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the
    range of supported deployment target versions is 9.0 to 14.0.99. (in target 'nanopb' from project
    'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the
    range of supported deployment target versions is 9.0 to 14.0.99. (in target 'leveldb-library' from
    project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the
    range of supported deployment target versions is 9.0 to 14.0.99. (in target 'gRPC-Core' from project
    'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the
    range of supported deployment target versions is 9.0 to 14.0.99. (in target 'gRPC-C++' from project
    'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the
    range of supported deployment target versions is 9.0 to 14.0.99. (in target
    'gRPC-C++-gRPCCertificates-Cpp' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the
    range of supported deployment target versions is 9.0 to 14.0.99. (in target 'fluttertoast' from
    project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the
    range of supported deployment target versions is 9.0 to 14.0.99. (in target 'firebase_core' from
    project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the
    range of supported deployment target versions is 9.0 to 14.0.99. (in target 'firebase_auth' from
    project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the
    range of supported deployment target versions is 9.0 to 14.0.99. (in target 'cloud_firestore' from
    project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the
    range of supported deployment target versions is 9.0 to 14.0.99. (in target 'abseil' from project
    'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the
    range of supported deployment target versions is 9.0 to 14.0.99. (in target 'Toast' from project
    'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the
    range of supported deployment target versions is 9.0 to 14.0.99. (in target 'PromisesObjC' from
    project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the
    range of supported deployment target versions is 9.0 to 14.0.99. (in target 'GoogleDataTransport'
    from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the
    range of supported deployment target versions is 9.0 to 14.0.99. (in target 'GoogleUtilities' from
    project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the
    range of supported deployment target versions is 9.0 to 14.0.99. (in target 'BoringSSL-GRPC' from
    project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the
    range of supported deployment target versions is 9.0 to 14.0.99. (in target 'FirebaseAuthInterop'
    from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the
    range of supported deployment target versions is 9.0 to 14.0.99. (in target 'Flutter' from project
    'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the
    range of supported deployment target versions is 9.0 to 14.0.99. (in target 'Firebase' from project
    'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the
    range of supported deployment target versions is 9.0 to 14.0.99. (in target
    'FirebaseCoreDiagnosticsInterop' from project 'Pods')

Could not build the application for the simulator.
Error launching application on iPhone 11.

我已经完成了从 flutter pub get、完成 pod 安装、pod 更新、flutter clean 和 flutter run 的所有工作 但错误来了 我有最新版本的flutter、dart、cocoapods

【问题讨论】:

【参考方案1】:

转到iOS目录下的Podfile并更改ios版本

# Uncomment this line to define a global platform for your project
# platform :ios, '9.0' // you have to change this because firebase required 9 to 14

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

【讨论】:

如果对您有用,请接受我的回答。

以上是关于无法为模拟器构建应用程序的主要内容,如果未能解决你的问题,请参考以下文章

我无法解决(无法为模拟器构建我的应用程序。)

无法为颤振模拟器构建应用程序

由于 CoreData 无法创建构建:应用程序中没有核心数据时 API 滥用,并且应用程序为所有模拟器构建

无法为模拟器构建应用程序。在 iPhone 12 上启动应用程序时出错

“无法为模拟器构建应用程序。” “在 iPhone 11 上启动应用程序时出错。”

将 cloud_firestore 添加到 pubspec Flutter 后无法为模拟器构建应用程序