Ilia Tikhomirov
Ilia Tikhomirov

Reputation: 599

Flutter: The app doesn't get built for iOS

My app fails to build for iOS, yet works fine on Android. Flutter clean or pod install commands don't help.

Steps to Reproduce

flutter build ios

Logs

and attach all the log output below between the lines with the backticks. If there is an exception, please see if the error message includes enough information to explain how to solve the issue. -->

Encountered error while building for device.
Elliots-Mac-mini:club_lime elliot_thm$ flutter clean
Deleting 'build/'.
Deleting '/Users/elliot_thm/Documents/club_lime/.dart_tool/'.
Elliots-Mac-mini:club_lime elliot_thm$ flutter build ios
Building com.vivaleasure.clubLime for device (ios-release)...
Automatically signing iOS for device deployment using specified development team in Xcode project: 6NDB4SY6HS
Running pod install...                                              1.1s
Running Xcode build...                                                  
 ├─Building Dart code...                                    34.7s
 ├─Generating dSYM file...                                   0.3s
 ├─Stripping debug symbols...                                0.0s
 ├─Assembling Flutter resources...                           1.2s
 └─Compiling, linking and signing...                         1.7s
Xcode build done.                                           39.0s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    === BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Release ===
    2019-07-08 12:13:10.058 defaults[26804:842682] 
    The domain/default pair of (/Users/elliot_thm/Documents/club_lime/build/ios/Release-iphoneos/Runner.app/Frameworks/App.framework/flutter_assets/ios/Flutter/App%202.framework/Info.plist, CFBundleExecutable)
    does not exist
    fatal error: lipo: can't map input file: /Users/elliot_thm/Documents/club_lime/build/ios/Release-iphoneos/Runner.app/Frameworks/App.framework/flutter_assets/ios/Flutter/App%202.framework/ (Invalid argument)
    fatal error: lipo: can't map input file: /Users/elliot_thm/Documents/club_lime/build/ios/Release-iphoneos/Runner.app/Frameworks/App.framework/flutter_assets/ios/Flutter/App%202.framework/ (Invalid argument)
    Failed to extract arm64 for /Users/elliot_thm/Documents/club_lime/build/ios/Release-iphoneos/Runner.app/Frameworks/App.framework/flutter_assets/ios/Flutter/App%202.framework/. Running lipo -info:
    fatal error: lipo: can't map input file: /Users/elliot_thm/Documents/club_lime/build/ios/Release-iphoneos/Runner.app/Frameworks/App.framework/flutter_assets/ios/Flutter/App%202.framework/ (Invalid argument)
flutter analyze
Analyzing club_lime...                                                  
No issues found! (ran in 2.5s)
flutter doctor -v
[✓] Flutter (Channel stable, v1.5.4-hotfix.2, on Mac OS X 10.14.5 18F132, locale en-AU)
    • Flutter version 1.5.4-hotfix.2 at /Users/elliot_thm/flutter
    • Framework revision 7a4c33425d (10 weeks ago), 2019-04-29 11:05:24 -0700
    • Engine revision 52c7a1e849
    • Dart version 2.3.0 (build 2.3.0-dev.0.5 a1668566e5)


[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
    • Android SDK at /Users/elliot_thm/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 10.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.2.1, Build version 10E1001
    • ios-deploy 1.9.4
    • CocoaPods version 1.7.2

[!] Android Studio (version 3.4)
    • Android Studio at /Applications/Android Studio.app/Contents
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)

[✓] VS Code (version 1.36.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.2.0

[✓] Connected device (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 8.1.0 (API 27) (emulator)

! Doctor found issues in 1 category.

Upvotes: 11

Views: 24297

Answers (7)

Akam Barznji
Akam Barznji

Reputation: 425

Just Click flutter doctor or run

Flutter Doctor

and look for Xcode installation and install it completely by using those tow commands

1.sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer

2.sudo xcodebuild -runFirstLaunch

Fixed for me

Upvotes: 1

CodeFarmer
CodeFarmer

Reputation: 2708

flutter create -i swift -a kotlin project_name
cd project_name
flutter run

Upvotes: 0

Hai nguyen thanh
Hai nguyen thanh

Reputation: 728

In my case, I need to check off the build flag: enter image description here

Upvotes: 0

LOLWTFasdasd asdad
LOLWTFasdasd asdad

Reputation: 2903

Note that this issue seems to be a bug in the current flutter version (1.20.2 bbfbf17). It seems to be fixed in the newest flutter version on the dev channel.

So if you can use the dev channel:

flutter channel dev
flutter upgrade --force
flutter build ios

Using the dev channel fixed it for me.

This will probably be hotfixed in 1.20.3

Comment on the issue from the 14.08.2020:

The fix #61129 is not available on the 1.20 stable channel. It is available in 1.21.0-1.0.pre, which is currently the dev channel. It is being evaluated for 1.20 stable hotfix. If you are still seeing this issues in 1.21.0-1.0.pre or later, please file a new issue and completely fill out the template so we can investigate.

See cherrypicks for 1.20.3: https://github.com/flutter/flutter/pull/64984


EDIT:

This issue seems to be fixed. See the release log:

https://github.com/flutter/flutter/releases/tag/1.20.3

Using flutter upgrade will fix the issue.

Upvotes: 1

A.Mushate
A.Mushate

Reputation: 455

first backup your existing ios folder. delete it and run

    flutter create .

it will generate the ios folder. build and run, and you should be good to go.

Upvotes: 22

Eduardo Schmidt
Eduardo Schmidt

Reputation: 31

I had the same problem. Fixing by clearing the build folder

Upvotes: 1

Ilia Tikhomirov
Ilia Tikhomirov

Reputation: 599

At the end I was able to resolve the issue by creating a new project using

flutter create -i swift -a kotlin project_name

and moving lib folder there without any changes to the dart code.

Upvotes: 4

Related Questions