Android Studio cannot run the Xcode Simulator

放肆的年华 提交于 2021-01-28 00:11:24

问题


I am trying to simulate my Flutter app with the Xcode iPhone Simulator and I get this error. Before upgrading Android Studio and Xcode it was working fine.

Launching lib/main.dart on iPhone X in debug mode...
Starting Xcode build...
Xcode build done.
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **
    
Xcode's output:
↳
    error: Multiple commands produce '/Users/User/AndroidStudioProjects/my_app/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/Flutter.framework':
    1) Target 'Runner' has copy command from '/Users/User/AndroidStudioProjects/my_app/ios/Flutter/Flutter.framework' to '/Users/User/AndroidStudioProjects/my_app/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/Flutter.framework'
    2) That command depends on command in Target 'Runner': script phase “[CP] Embed Pods Frameworks”
    warning: ignoring duplicated output file: '/Users/User/AndroidStudioProjects/my_app/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/Flutter.framework' (in target 'Runner')
    note: Using new build systemnote: Planning buildnote: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone X.

Using:

  • macOS 10.13.6 (17G65)
  • Android Studio 3.2 Build #AI-181.5540.7.32.5014246, built on September 18, 2018
  • Xcode 10.0 (10A255)
  • Xcode Simulator 10.0 (SimulatorApp-869.5 CoreSimulator-572.2)

回答1:


Should be fixed in master channel

https://github.com/flutter/flutter/issues/20685#issuecomment-421511890

Workarounds

There are two workarounds:

  • Option 1: Use the legacy build system . As noted by @gi097, open ios/Runner.xcworkspace, and change the build system to Legacy Build System.
  • Option 2: Use the new Xcode 10 build system.
    1. Open ios/Runner.xcworkspace
    2. Select the Runner project in the project navigator sidebar.
    3. In the main view, select the Runner target, then select the Build Phases tab.
    4. Expand the Embed Frameworks phase and select Flutter.framework from the embedded frameworks list.
    5. Click - to remove Flutter.framework from the list (be sure to keep App.framework).


来源:https://stackoverflow.com/questions/52533352/android-studio-cannot-run-the-xcode-simulator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!