简体   繁体   中英

Flutter iOS build is stuck on "Running Xcode Build"

I recently got a mac to be able to test the iOS applications I made with Flutter/Dart. But when trying to transfer all my files to a Mac and try to test it, it gets on "Running Xcode Build."

I am importing 2 things in my pubspec.yaml file:

dependicies:
  flutter:
    sdk:
      cupertino_icons: ^0.1.2
      firebase_admob: ^0.9.0+10

In my podfile, which I was told to download on the google admobs documentation I have

pod 'Google-Mobile_Ads_SDK"

My Flutter Doctors reads:

[flutter] flutter doctor -v
Unable to find any JVMs matching version "(null)".
No Java runtime present, try --request to install.
Unable to find any JVMs matching version "(null)".
No Java runtime present, try --request to install.
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.2 19C57, locale en-US)
    • Flutter version 1.12.13+hotfix.5 at /Users/priscilla/Desktop/Temp/flutter
    • Framework revision 27321ebbad (5 weeks ago), 2019-12-10 18:15:01 -0800
    • Engine revision 2994f7e1e6
    • Dart version 2.7.0

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/priscilla/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /usr/bin/java
    ✗ Could not determine java version

[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.3.1, Build version 11C504
    • CocoaPods version 1.8.4

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/setup/#android-setup for detailed instructions).

[✓] Connected device (1 available)
    • iPhone 11 Pro Max • 754DF0BD-203E-4A0A-B785-E92D4B1D9C38 • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator)

! Doctor found issues in 2 categories.

And the change to my info.plist is: (The actual app ID is in my code, just didn't want to post it here)

<key>GADApplicationIdentifier</key>
<string>[APP_ID]</string>

If I were to create a new Flutter project from scratch, the given code runs perfectly fine. It is just when I try to import the files the project on my windows PC to my Mac.

I think a solution would be to create a new Flutter project and while creating import my files, but I am not sure how to do that. So at the moment, I created a new Flutter project, deleted all the files that comes loaded initially, then replaced them with my project files.

in my case, I use Firebase Firestore.

it doesn't stuck actually, but it takes waaaay too long to build in Xcode. don't forget to improve iOS build times as per the official documentation in here

Currently the Firestore iOS SDK depends on some 500k lines of mostly C++ code which can take upwards of 5 minutes to build in XCode. To reduce build times significantly, you can use a pre-compiled version by adding 1 line to your ios/Podfile inside your Flutter project.

please open that documentation to improve the build time, because the code maybe updated.

after adding that 1 line on your iOS podfile, don't forget to do flutter clean before rebuild the project. the second time you build the project it should be faster ( around 5 minutes for my project )

I had removed the external devices specifically external monitors attached to Mac. Then made the build.

My build time came from 10min on average to 0.5 to 2 min max.

iOS(Build) IPA building was taking around 14456.14 Sec ie (more than 4 hrs ) after updating to the below version it was reduced to 2143.3 Sec ie (less than 40 mins )

  1. Changed From:

     environment: sdk: ">=2.7.0 <3.0.0"

    Changes To:

     environment: sdk: '>=2.12.0 <3.0.0'
  2. Change the whole project to Null-safety

    Please follow https://dart.dev/null-safety/migration-guide

In My Experience, this first build indeed takes a long time - but after you run it once - the build time is reasonable.

If your build is stuck on Running Xcode build..., try the solution below:

cd Project Folder >

rm -R build

rm.dart_tool

rm.packages

rm -Rf ios/Pods

rm -Rf ios/.symlinks

rm -Rf ios/Flutter/Flutter.framework

rm -Rf ios/Flutter/Flutter.podspec

pod cache clean --all

cd ios > pod deintegrate

pod setup

arch -x86_64 pod install cd..

flutter clean -v

flutter pub get

flutter clean && flutter run

If the above fails, clone the project again and flutter run.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM