Flutter: iOS build fails - ios

I have an issue with Flutter. I can't run my app on an iOS simulator. I've tried to create a new certificate under the Mac keychain and that didn't help me much. Does anyone know how I can fix this problem?
(base) seroaslan#Seros-MBP Desktop % flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.12.13+hotfix.9, on Mac OS X 10.15.4 19E287, locale da-DK)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.4.1)
[✓] Android Studio (version 3.5)
[!] IntelliJ IDEA Ultimate Edition (version 2020.1.1)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] VS Code (version 1.44.2)
[✓] Connected device (1 available)
! Doctor found issues in 1 category.
(base) seroaslan#Seros-MBP tutorial % flutter run
Launching lib/main.dart on iPhone 8 in debug mode...
Running Xcode build...
├─Assembling Flutter resources... 2,8s
└─Compiling, linking and signing... 3,0s
Xcode build done. 9,2s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
/Users/seroaslan/Desktop/tutorial/build/ios/Debug-iphonesimulator/Runner.app: resource fork, Finder
information, or similar detritus not allowed
Command CodeSign failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone 8.

The answer is in your flutter doctor:
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
You will need to fix these issues by setting it all up again as shown here: https://flutter.io/setup-macos/

Related

Flutter run xcode build fails but building directly with xcode succeeded

I'm new to iOS development and I ran into this problem at the very beginning:
When I tried to flutter run my hello world app I got xcodebuild failed (I took only the last lines since it's too long):
81 errors generated.
<unknown>:0: error: failed to emit precompiled header '/Users/mehec/Library/Developer/Xcode/DerivedData/Runner-cssmbpuzzkyjvpfghedbpvdhbbmr/Build/Intermediates.noindex/PrecompiledHeaders/Runner-Bridging-Header-swift_2PXLF604USZTM-clang_KLU4EDN5EN1U.pch' for bridging header '/Users/mehec/Desktop/bgp/learn_flutter_0_test/ios/Runner/Runner-Bridging-Header.h'
<unknown>:0: error: generate-pch command failed with exit code 1 (use -v to see invocation)
note: Using new build system
note: Planning build
note: Constructing build description
I then tried to build and run in xcode and everything's fine.
I have tried flutter clean and flutter upgrade even creating a new project but no effect
I'm using macOS 10.14.6, IntelliJ Idea 2020.1, Flutter 1.17.5 and 1.19.0, Xcode 11.3.1
the code in main.dart:
import 'package:flutter/material.dart';
void main() {
runApp(Center(
child: Text(
"hello world",
textDirection: TextDirection.rtl,
),
));
}
flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, 1.19.0-4.3.pre, on Mac OS X 10.14.6 18G5033, locale en-US)
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, set ANDROID_SDK_ROOT to that location.
You may also want to add it to your PATH environment variable.
[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
[!] Android Studio (not installed)
[✓] IntelliJ IDEA Ultimate Edition (version 2020.1.3)
[✓] Connected device (1 available)
! Doctor found issues in 2 categories.
Thanks!
I had a similar problem.
The build from Xcode.app was successful, but the build from the command line or Android Studio failed.
Finally, I reinstalled rbenv, and the problem went away.
In other Github comments, some people solved the problem with conda deactivate, so I think the problem is caused by a bug in the development environment that Xcode.app does not refer to, such as ruby or python environment.

Flutter installed but failed to start-up on real IOS device

Flutter failed to start-up on real IOS device (not emulator), its working fine on the IOS emulator but when I connect my device its installed but fails to launch without printing any message on flutter application log.
Launching lib/main.dart on XXXX in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: XXXXX
Running Xcode build...
└─Compiling, linking and signing... 10.7s
Xcode build done. 20.1s
Installing and launching...
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, v1.15.4-pre.262, on Mac OS X 10.14.6 18G3020, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
[✓] Android Studio (version 3.5)
[✓] IntelliJ IDEA Ultimate Edition (version 2019.3.1)
[✓] Connected device (1 available)
• No issues found!
could you please help!
There was an issue on Flutter repository as mentioned by #amer rawashdeh.
iOS 13.4 is now available, please update your iOS device and Xcode to v11.4 to keep your project newly working.
If you are on Flutter stable channel you need also to apply this guide to keep you project working with v11.4 Xcode
It seems the problem with ISO version 13.3.1 only
check it out:
https://github.com/flutter/flutter/issues/49504#issuecomment-581554697
The application was working on IOS emulator version 13.3

When building Flutter project from Android Studio it fails, but not from Xcode (after flutter upgrade)

I recently upgraded Flutter framework, and when I try to build and run the project from Android Studio, I get the following warnings and error:
Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
Running Xcode build...
Xcode build done. 2.2s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
<built-in>:1:10: warning: non-portable path to file '"/Users/<something ...>/ios/Pods/Target Support Files/AppCenter/appcenter-prefix.pch"'; specified path differs in case from file name on disk [-Wnonportable-include-path]
#include "/Users/<something ...>/ios/Pods/Target Support Files/appcenter/appcenter-prefix.pch"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"/Users/<something ...>/ios/Pods/Target Support Files/AppCenter/appcenter-prefix.pch"
1 warning generated.
1 warning and 1 error generated.
error: the following command failed with exit code 0 but produced no further output
CompileC /Users/stefanciprian/Library/Developer/Xcode/DerivedData/Runner-gsbrrhndnahwimaidnqhpsuayzxa/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/appcenter_analytics.build/Objects-normal/x86_64/AppcenterAnalyticsPlugin.o /Users/stefanciprian/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/appcenter_analytics-0.2.1/ios/Classes/AppcenterAnalyticsPlugin.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
note: Using new build system
note: Planning build
note: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone 11 Pro Max.
If I open the project in Xcode, I get the same warnings, but somehow I manage to build and run successfully on the Simulator.
I tried some suggestions from GitHub Issues regarding paths & symlinks, but they seem to not work.
Also added flutter doctor info:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.2 19C57, locale en-RO)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.3)
[✓] Android Studio (version 3.5)
[✓] IntelliJ IDEA Ultimate Edition (version 2019.3.1)
[✓] VS Code (version 1.41.1)
[✓] Connected device (1 available)
• No issues found!

Flutter stuck on Building Dart code after doing flutter build ios

I'm trying to build an archive by doing flutter build ios but I encounter a problem on Starting Xcode build
$ flutter build ios
Building com.example.example for the device (ios-release)...
Automatically signing iOS for device deployment using specified
development team in Xcode project: XXXXXX
Running pod install...
Starting Xcode build...
├─Building Dart code...
I already build an archive one (last week) and it was working. Maybe this is due to flutter upgrade ?
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v0.11.3, on Mac OS X 10.14.1 18B75, locale
en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK
28.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
[✓] Android Studio (version 3.2)
[✓] VS Code (version 1.29.1)
That's an issue that was fixed very recently and the fix should already be available in the master channel.
flutter channel master
flutter doctor
You can also try dev channel, but I'm not sure if it landed there already.
The fix will of course be included in the next beta channel, but a beta release just came out last week, so it will probably take a while to the next.
See also https://github.com/flutter/flutter/issues/24139

Pub can't retrieve any Dart packages

No matter which dart package I am trying to fetch, pub fails retrieving it.
When in my project root folder, I run:
flutter packages get
I consistently get:
Got socket error trying to find package cupertino_icons at https://pub.dartlang.org.
pub get failed (69) -- attempting retry 1 in 1 second...
Here is the output from flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (on Mac OS X 10.13.3 17D47, locale en-US, channel beta)
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.2)
[✓] Android Studio (version 3.0)
[✓] IntelliJ IDEA Community Edition (version 2017.3.5)
[!] VS Code (version 1.21.1)
[!] Connected devices
! No devices available
! Doctor found issues in 2 categories.
and the pubspec is what comes with IntelliJ Flutter's wizard:
name: my_friendchat
description: A new Flutter project.
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: "0.1.1"
Any idea how to fix pub?
So... restarting my laptop just fixed it. 😕

Resources