58

I'm running a flutter project and when dragging any list or scroll view on the simulator, it scrolls with way too much force rendering almost impossible to get to the row I need.

This only happens in the simulator, and it seems to work fine on a real device. Also, this problem started when I had migrated to an Apple M1 MacBook Pro.

Drag is minimal

Any ideas?

3
  • if your problem is not in a device or creating a jank in performance i can't see a problem here, probably you computer process way faster that an iPhone. just verify you performance is ok and that should be good enough. Dec 28, 2020 at 18:58
  • 4
    Of course, it is a problem! It essentially makes the simulator useless for developing any app with a list.
    – Dan1ell
    Mar 11, 2022 at 16:26
  • recently I faced the same issue, it seems it was because one of the native plugins has arm64 in Excluded Architectures setting. Removing arm64 from this setting (keeping only i386) and wiping all data from simulator solved the issue. Abviously that it depends on plugin itself, some of them suffer from wrong binary usage on M1 chip simulators
    – tatsuDn
    Aug 18, 2022 at 8:06

5 Answers 5

80

I experienced a similar issue but the problem, in my case, is not related to speed but something different.

Specifically, if you force your iOS Simulator to run under Rosetta you'll see that it works as expected. Not sure why, but this is what I'm experiencing. Always reproducible with 1.22.5 (stable).

To run in Rosetta, right click on Xcode and choose "Show Package Contents", from there you navigate to "Contents > Developer > Applications," There you'll find the Simulator app. If you right click on it and choose "Get Info", you'll find an option to run it using Rosetta.

Update 14/9/2021: Xcode 12.5.1 no longer needs the above workaround. Scrolling is working fine out-of-the-box.

Update 29/10/2023: Xcode 15.x and possible other versions in the past, unfortunately seems to suffer again of the infamous bug above.

I found that running Simulator with x86_64 emulation on Ventura, Sonoma as follow:

arch -x86_64 /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator

workaround the problem.

16
  • 22
    I'm using Xcode 13.1 on a M1 Pro and was still having this issue. Forcing the simulator to run under Rosetta fixed it. The M1 has been available for over a year, not sure why we're still dealing with these kind of bugs.
    – Vallette
    Nov 29, 2021 at 19:58
  • 8
    This works! However, I would remove the update about it working with Xcode 12.5.1. I'm on 13.2 and it is still broken.
    – jdixon04
    Jan 5, 2022 at 18:17
  • 7
    I am using Xcode 13.2.1 but it doesn't work out of the box. However the Rosetta fix works. Any idea why the issue is still there? Jan 24, 2022 at 11:23
  • 14
    The scrolling bug still persists and there's no option to run the Simulator app using Rosetta anymore and the issue filed on the official Flutter repository has been closed. XCode version is 14.0. Sep 24, 2022 at 9:26
  • 9
    Still scrolling bug exists. XCode version 14.2. Jan 27 at 7:00
23

[2023 Solution]

Just need to using x86_64 Simulator. Follow these step on Terminal after close Simulator

1. Get list device ID:
xcrun simctl list

2. Launch:
xcrun simctl boot [deviceID] --arch=x86_64

Ex:
xcrun simctl boot 2BDDB447-AA8D-4BD4-8BFA-2F54363C2235 --arch=x86_64

Sometime Simulator will not automatic launch so you need to open it manually after step 2

8
  • 4
    This worked, it took a long time to run but is working. Not a perfect solution but a solution. Jul 4 at 13:48
  • 3
    Finally, this works!! Aug 12 at 2:56
  • 1
    I had another issue with the swipe scrolling abruptly stopping instead of getting a smooth scroll when I released the swipe gesture. This fixed it. Sep 9 at 16:33
  • 2
    This works! It should be the accepted answer. Sep 25 at 14:49
  • 1
    This works. Thanks so much!
    – An Tran
    Nov 10 at 7:52
8

[2022 update] The accepted answer no longer works, as there is no option in the iOS Simulator's Get Info dialog to run with Rotessa. Instead, what you can do is launch the iOS Simulator from Terminal using the following command:

arch -x86_64 /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator
4
  • 2
    Gets exactly the same result. Still scrolling fast. Dec 9, 2022 at 1:38
  • 9
    This answer did not work for me. I am using M1 MbPro, XCode 14.2 Dec 28, 2022 at 14:03
  • It doesn't work at all. Jan 26 at 10:51
  • Not working on XCode 15. Anyone found a solution ?
    – TSR
    Oct 24 at 23:31
3

With me, this suddenly came up again with XCode 14/iOS 16. Fixed it in the ios/Podfile

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
      config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64 i386"
    end
  end
end

Remove arm64, so change the line to:

      config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "i386"
1
  • Sadly, this doesn't help me, as I receive such error instead: error: the following command failed with exit code 0 but produced no further output GenerateDSYMFile (...) for one of my Flutter plugins
    – Albert221
    Dec 29, 2022 at 13:27
1

Jank is completely gone once you run the app while targetting arm64.

DO NOT DO THAT IF YOUR DEPENDENCIES CONTAIN NATIVE BINARIES One such example is google_maps_flutter, they don't provide arm64 binaries and as such, attempting to compile the project on M1 natively will result in errors.

Open app's ios folder in xcode, click on Runner and edit Build Settings so that Architectures points to arm64 and Excluded Architectures doesn't contain arm64 how it should look like (more or less)

(even though these gifs are only 10 seconds long, they are over 2MB and can't be embedded, sorry for that)

2
  • This means that if my app is using such dependencies, I'm left with no option at all? Awesome. Sep 24, 2022 at 9:27
  • You can clone the library and edit the podspec in such a way that will make it possible for it to run on ARM, but that's quite a lot of hassle github.com/flutter/plugins/blob/main/packages/…
    – eeqk
    Sep 24, 2022 at 17:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.