Flutter app can run in Xcode and not in Android Studio

Viewed 1480

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.
1 Answers

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á!

Related