Flutter app can run in Xcode and not in Android Studio

1,085

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

Share:
1,085
Tomas Ward
Author by

Tomas Ward

I love programming.

Updated on January 01, 2023

Comments

  • Tomas Ward
    Tomas Ward over 1 year

    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.
    
    • daddygames
      daddygames over 2 years
      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.
    • Tomas Ward
      Tomas Ward over 2 years
      @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
    Tomas Ward over 2 years
    The "pod install" command will continuously override these settings. Checkout this SO post for more info on how to manually change this forever: stackoverflow.com/questions/63607158/…