iOS Simulator bad performance after run flutter upgrade - ios

After upgrade flutter, the performance of iOS Simulator became so bad. for example, slow to launch and slow to show keyboard.
I ran flutter doctor. Here is my result.
$ flutter doctor -v
[✓] Flutter (Channel master, v1.9.8-pre.35, on Mac OS X 10.14.6 18G87, locale ja-JP)
• Flutter version 1.9.8-pre.35 at /Users/rafekun/Developer/flutter
• Framework revision 1363528eee (4 days ago), 2019-08-31 05:26:41 -0400
• Engine revision cd858489cc
• Dart version 2.5.0 (build 2.5.0-dev.4.0 36985859e4)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
• Android SDK at /Users/rafekun/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_202-release-1483-b49-5587405)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 10.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.3, Build version 10G8
• CocoaPods version 1.7.5
[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 38.2.3
• Dart plugin version 191.8423
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
[✓] VS Code (version 1.37.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.3.0
[✓] Connected device (1 available)
• iPhone Xʀ • B3C345C3-5AB0-4627-B854-2C90016A3B69 • ios •
com.apple.CoreSimulator.SimRuntime.iOS-12-4 (simulator)
• No issues found!

If you are experiencing slowness, low FPS, laggy scrolling on specific (newer) devices in Xcode simulator that's because Apple dropped support for OpenGL and Flutter SDK does not support the new Metal API in simulators.
But the official stable support will be available soon, until that if you need 60 FPS, switch to the master channel of Flutter SDK by running this in terminal and rebuild your app:
flutter channel master
sources:
iOS Simulator gradually becomes very slow & unusable
Investigate enabling Metal on iOS simulators above version 13.0.
Will Flutter use Metal on iOS Simulators?

Related

Failed to launch iOS Simulator: Error: Emulator didn't connect within 60 seconds

Flutter doctor -v(same result with and without ios simulator running)
flutter doctor -v
[✓] Flutter (Channel stable, 2.2.3, on Mac OS X 10.14.6 18G103 darwin-x64, locale en-US)
• Flutter version 2.2.3 at /Users/faizan/Developer/flutter
• Framework revision f4abaa0735 (8 weeks ago), 2021-07-01 12:46:11 -0700
• Engine revision 241c87ad80
• Dart version 2.13.4
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/faizan/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• ANDROID_HOME = /Users/faizan/Library/Android/sdk
• Java binary at: /Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/bin/java
• Java version Java(TM) SE Runtime Environment (build 1.8.0_301-b09)
• All Android licenses accepted.
[!] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.1, Build version 10B61
✗ Xcode 10.1.0 out of date (12.0.1 is recommended).
Download the latest version or update via the Mac App Store.
• CocoaPods version 1.10.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[!] Android Studio (version 2020.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
✗ Unable to find bundled Java version.
• Try updating or re-installing Android Studio.
[✓] VS Code (version 1.59.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.25.0
[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-x64 • Mac OS X 10.14.6 18G103 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 92.0.4515.159
! Doctor found issues in 2 categories.
No devices in bottom tab of vscode even i started the ios simulator. Same happens with android studio
I tried both 12.0.1 xcode and 10.1 with and without command line tools
Go to your system activity monitor, search for simulator, double click on it, then quit ==> then fore quit.
It should work afterwards. Don't know why it happens, but it's not the first time, happens on and off.

Build for iOS fails in Xcode 11

I change my iOS SDK to 14.0 from 13.4 then I try to build for ios but it fails when I try to build using 13.4. It doesn't show an error but I cannot upload the app it says error on the picture so needs to upgrade my SDK.
Here is my flutter --verbose:
[✓] Flutter (Channel stable, 2.0.5, on Mac OS X 10.15.3 19D76 darwin-x64, locale en-US)
• Flutter version 2.0.5 at /Users/fee/Documents/Developer/flutter
• Framework revision adc687823a (2 weeks ago), 2021-04-16 09:40:20 -0700
• Engine revision b09f014e96
• Dart version 2.12.3
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/fee/Library/Android/sdk
• Platform android-30, build-tools 28.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.
[!] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.4.1, Build version 11E503a
! Xcode 11.4.1 out of date (12.0.1 is recommended).
Download the latest version or update via the Mac App Store.
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 44.0.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
[✓] Connected device (2 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 90.0.4430.93
And, here is the error shown
Error output from Xcode build:
2021-04-30 13:05:34.432 XCBBuildService[28375:199855] /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk: error: SDK 'iphoneos14.0'
already registered from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk
2021-04-30 13:05:34.610 XCBBuildService[28375:199855] /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk: error: SDK 'iphoneos14.0'
already registered from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk
2021-04-30 13:05:34.840 XCBBuildService[28375:199855] /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk: error: SDK 'iphoneos14.0'
already registered from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk
** BUILD FAILED **
Xcode's output:
↳
note: Using new build system
note: Building targets in parallel
error: unknown error while handling message: unableToInitializeCore(errors: ["/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk:
error: SDK \'iphoneos14.0\' already registered from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk"])
I want your help to find where is this error comes from.
Your flutter doctor basically mentioned the problem for you:
Xcode 11.4.1 out of date (12.0.1 is recommended).
while Xcode 12 is required to build and upload to App Store. Update Xcode and try building again.

callback_cache.cc(132) Could not parse callback cache, aborting restore - [Flutter]

I am trying to run Flutter application after my latest flutter upgrade.
It shows below error
Runner[58802:2599379] [VERBOSE-1:callback_cache.cc(132)] Could not parse callback cache, aborting restore
Application shuts after native Splash screen.
In Android platform it works but when trying to run debug app to iOS simulator it gives above error
Flutter LOG
[✓] Flutter (Channel master, 1.18.0-10.0.pre, on Mac OS X 10.15.4 19E287, locale
en-GB)
• Flutter version 1.18.0-10.0.pre at /Users/harshbhavsar/flutter
• Framework revision a58d50deb1 (3 weeks ago), 2020-04-29 13:04:59 -0700
• Engine revision 2db3276573
• Dart version 2.9.0 (build 2.9.0-3.0.dev 726d3c7725)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.1)
• Android SDK at /Users/harshbhavsar/Library/Android/sdk
• Platform android-29, build-tools 29.0.1
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.4.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.4.1, Build version 11E503a
• CocoaPods version 1.9.1

Flutter: Abnormally Release sizes

While building on both platforms, I noticed the following:
app.ipa 190MB,
Runner - 427,3Mb
Apk 7,2MB
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.14.5 18F132, locale en-IT)
• Flutter version 1.12.13+hotfix.5 at /Users/cosminrus/Utils/flutter
• Framework revision 27321eb (3 months 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/cosminrus/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: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.3, Build version 11C29
• CocoaPods version 1.8.4
[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 42.1.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
[✓] VS Code (version 1.41.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.7.1
[!] Connected device
! No devices available
! Doctor found issues in 1 category.
Flutter build sizes depends on the build execution is being used. For context, JIT and AOT are the both logics being used by Flutter to be really powerful.
JIT: Allows to do hot reload and see real time changes, the cons is that huge build size.
AOT: Builds on native code allowing Flutter to run full speed, build sizes are smaller.
You'd notice this on Android as well while checking its size on debug vs release mode.
To get a better idea of how much your app's size is going to be, run the following commands on terminal:
Android
flutter build apk --split-per-abi
and check the output file sizes.
iOS
flutter build ios && tar -zcf build/app.ipa build/ios/iphoneos/Runner.app && ls -lh build/app.ipa
If you want to dig into reducing file size, follow this LINK. And if you want to know why iOS builds are larger, check this LINK.
There's an official DOCS for build sizes if you're interested.

Flutter - Failed to build iOS app on Android Studio

I'm using Flutter with Android-Studio, everything was working great (i.e. compiling and deploying to iOS simulators except until I installed Fastlane Tools. The building process now is broken somehow! I'm not sure if it's from Fastlane or something else though, but now I'm stuck and cannot deploy to iOS anymore.
Steps taken/tried already:
Removing XCode & CommandLineTools (using this post: Complete removal old XCode)
Reinstalling XCode 9.2 (from AppStore)
Reinstalling CommandLineTools for XCode 9.2 (dl from developer tools page)
Reinstalling/updating ios-deply using:
npm install -g ios-deploy --unsafe-perm=true
Error log is on PasteBin to reduce post size:
https://pastebin.com/HQdJYLBr
Flutter doctor report:
[✓] Flutter (on Mac OS X 10.13.3 17D102, locale en-AE, channel alpha)
• Flutter version 0.0.22-pre.1 at /Users/user999/github/flutter
• Framework revision 553fc4264e (3 weeks ago), 2018-03-01 09:30:25 -0800
• Engine revision 6921873c71
• Tools Dart version 2.0.0-dev.16.0
• Engine Dart version 2.0.0-edge.da1f52592ef73fe3afa485385cb995b9aec0181a
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
• Android SDK at /Users/user999/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-27, build-tools 27.0.3
• 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-915-b08)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 9.2, Build version 9C40b
• ios-deploy 1.9.2
• CocoaPods version 1.4.0
[✓] Android Studio (version 3.0)
• Android Studio at /Applications/Android Studio.app/Contents
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)
[✓] IntelliJ IDEA Community Edition (version 2017.3.4)
• Flutter plugin version 21.2.3
• Dart plugin version 173.4548.30
[✓] Connected devices
• iPhone X • 2AD97E20-6FB5-4086-BDC0-EBE6138FBD79 • ios • iOS 11.2 (simulator)
Any suggestions, please?
This answer is for the ones who are still trying to work with Xcode 9.2. Starting April, 2020, all apps submitted to the App Store will need to be built with Xcode 11. So don't try to build your Flutter IOS App with XCode 9.2.
Flutter is also changing rapidly therefore, it is better to use the latest XCode version to avoid any deprecated API issue.
For reference visit:
https://github.com/firebase/firebase-ios-sdk/issues/4125

Resources