50

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?

Jacobo Koenig
  • 11,728
  • 9
  • 40
  • 75
  • 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. – Argel Bejarano Dec 28 '20 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 '22 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 '22 at 08:06

7 Answers7

79

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.

MJ Montes
  • 3,234
  • 1
  • 19
  • 21
valvoline
  • 7,737
  • 3
  • 47
  • 52
  • This did help with a similar issue, where the scrolling was "laggy"/"stuttering". Thank you very much! – Fabian Feb 09 '21 at 08:10
  • 1
    Fixed this very frustrating issue. Thanks, @valvoline! – ChrisH Aug 20 '21 at 17:31
  • This will make the simulator laggy on heavy apps though; performance won't be as good. – Oliver Dixon Aug 25 '21 at 15:44
  • 20
    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 '21 at 19:58
  • works thanks! .. – MJ Montes Dec 15 '21 at 07:35
  • 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 05 '22 at 18:17
  • Still seeing the same "super-fast scrolling" in the simulator: Flutter 2.8.1, MacBook Pro 16" with M1 Max, macOS Monterey 12.1, Xcode 13.2.1. Running the simulator with Rosetta fixed it. – Karsten Silz Jan 09 '22 at 23:09
  • 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? – Ravi Prakash Jan 24 '22 at 11:23
  • I have this problem with an old project. Running simulator with Rosetta enabled fixed it! – testerino May 17 '22 at 12:01
  • This didn't become a problem for me (on my new M1) until I added the "Google Maps API for iOS" to my app. Enabling Rosetta for the Simulator is a viable workaround but I'm still looking for a solution. Running Xcode 13.4. – MySilmaril May 20 '22 at 15:31
  • I'd updated my XCode last weekend, this problem persist and was fixed using the workaround of activating Rosetta – siega Aug 05 '22 at 19:59
  • 1
    The iOS 16 emulator has no "Rosetta" option any more. But today I found out that the problem was caused by a single plugin that had "'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64'" in its podspec file. Replacing it with "s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }" as in a new empty Flutter Plugin fixed the scrolling problem. – Dominique Sep 15 '22 at 18:14
  • 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. – Lalit Fauzdar Sep 24 '22 at 09:26
  • 8
    Still scrolling bug exists. XCode version 14.2. – HappyCoding Jan 27 '23 at 07:00
9

[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
Justin
  • 17,670
  • 38
  • 132
  • 201
8

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

Tek4Fun
  • 81
  • 1
  • 2
2

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"
Touwer
  • 301
  • 2
  • 5
  • 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 '22 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)

eeqk
  • 3,492
  • 1
  • 15
  • 22
  • This means that if my app is using such dependencies, I'm left with no option at all? Awesome. – Lalit Fauzdar Sep 24 '22 at 09: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 https://github.com/flutter/plugins/blob/main/packages/google_maps_flutter/google_maps_flutter_ios/ios/google_maps_flutter_ios.podspec – eeqk Sep 24 '22 at 17:01
-5

If you are using AndroidStudio, try this one.

  1. Find 'Flutter Performance' and open.

enter image description here

  1. Enable slow animations

enter image description here

The simulator scroll will be way much slower.

Bernard Hur
  • 120
  • 6
-6

This probably happens because the emulators are faster due to the usage of ARM.

Is it the only one speeded up animation? Maybe there are more. If so, set the timeDilatation.

import 'package:flutter/scheduler.dart' show timeDilation;

void main() {
  timeDilation = 2.0;
  runApp(new MyApp());
}
Frank Moreno
  • 304
  • 1
  • 7