3

As the title suggests, I simply cannot run my flutter app on Android Studio (using the IOS simulator). Somehow, if I run and fix all Xcode errors in Xcode itself, I am able to run it. However, when I try to run it in android studio a second later, many errors appear coming from the IOS build. There is no specific error log as the warning are always different. Here are some of the causes that I am suspicious of:

  1. I updated to Xcode 13, which has a new build system.
  2. I updated to a new Flutter version.
  3. I updated to a new Android Studio Version (Arctic Fox).

I have tried many things, including:

Pod deintegrate** & pod install
Cleaning and running
Restarting the computer
Legacy build system

All of the answers in this Stack Overflow post

There are just too many things I have tried, I only remember half of them. Here is my latest error log when trying to build from Android Studio:

EDIT-------- Here is my most recent error log:

Xcode's output:
↳
    ld: building for iOS Simulator, but linking in dylib built for iOS, file '/Users/tomasward/Desktop/Fredi/ios/Pods/TwitterKit/iOS/TwitterKit.framework/TwitterKit' 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
    /Users/tomasward/Desktop/Fredi/ios/Pods/Pods.xcodeproj: 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 15.0.99. (in target 'TOCropViewController-TOCropViewControllerBundle' from project 'Pods')
    /Users/tomasward/Desktop/Fredi/ios/Pods/Pods.xcodeproj: 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 15.0.99. (in target 'FMDB' from project 'Pods')
    /Users/tomasward/Desktop/Fredi/ios/Pods/Pods.xcodeproj: 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 15.0.99. (in target 'TOCropViewController' from project 'Pods')
    /Users/tomasward/Desktop/Fredi/ios/Pods/Pods.xcodeproj: 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 15.0.99. (in target 'Reachability' from project 'Pods')
    /Users/tomasward/Desktop/Fredi/ios/Pods/Pods.xcodeproj: 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 15.0.99. (in target 'AppAuth' from project 'Pods')
    /Users/tomasward/Desktop/Fredi/ios/Pods/Pods.xcodeproj: 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 15.0.99. (in target 'leveldb-library' from project 'Pods')
    /Users/tomasward/Desktop/Fredi/ios/Pods/Pods.xcodeproj: 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 15.0.99. (in target 'GoogleSignIn' from project 'Pods')

Could not build the application for the simulator.
Error launching application on iPhone 12 Pro.
Tomas Ward
  • 854
  • 6
  • 23
  • Apple requires the use Xcode to run on iOS simulator or device. I could be wrong, but that is my understanding and my take of how the [Flutter website describes testing for iOS](https://flutter.dev/docs/get-started/install/macos). – daddygames Sep 29 '21 at 13:52
  • @daddygames Android Studio and Flutter are prepared for simulation of IOS apps. I have already done it a thousand times. Android Studio takes the Xcode (IOS) module and runs it. However, after some updates, something is wrong and I can't get to the bottom of it. As if the errors only occur in Android Studio and not Xcode, which doesn't make sense since they are both running the same thing. – Tomas Ward Sep 29 '21 at 13:59

1 Answers1

2

Solved after a month

The only truly important error was the following:

ld: building for iOS Simulator, but linking in dylib built for iOS, file '/Users/tomasward/Desktop/Fredi/ios/Pods/TwitterKit/iOS/TwitterKit.framework/TwitterKit' for architecture arm64

What is it actually saying? arm64 is an architecture used for physical devices, not for the simulator. So, I was trying to simulate an invalid architecture in a virtual device. I had read that I needed to exclude arm64 from my build settings in my target project. However, the missing step was to also exclude it from pods as follows: enter image description here

Voilá!

Tomas Ward
  • 854
  • 6
  • 23
  • 1
    The "pod install" command will continuously override these settings. Checkout this SO post for more info on how to manually change this forever: https://stackoverflow.com/questions/63607158/xcode-12-building-for-ios-simulator-but-linking-in-an-object-file-built-for-io – Tomas Ward Sep 29 '21 at 23:12