13

The same project runs 60FPS on iOS emulator, but in android emulator everything is slow. I do nothing but there are hops in frame rate from 53 to 56. JS FPS and UI FPS are always identical. I created animated component and when I click on it everything runs smoothly on iOS (~60FPS), but android's JS FPS and UI FPS fall to 10FPS. Is it normal? I've read the link. Debug mode is turned off, there is no any console.log() in code. I plug Android phone, interface becomes smoother, but JS FPS falls to ~14 when I start animation. Animations in React Native uses native thread. How is that possible? There are some tweaks I should apply?

P.S. Mac Mini Late 2012, Quad Core i7, 16Gb RAM, SSD. AVD: Pixel XL, Android 6, x86, API 23, 2048Mb RAM, Graphics - Hardware GLES 2.0, Multi-core CPU 4. HAXM is used, as I understand...

enter image description here

enter image description here

3 Answers 3

8

Another tip - there is an option to run without debugging etc for performance testing:

Menu Click

Open the menu by 'shaking' the device (cmd+m on Mac, ctrl+m on Windows) and open settings. Then set JS Dev Mode to false and you'll see the app operate at much closer performance to what it would on a real device. The only downside is you don't get your debug logs, but useful to see how the app is likely to behave on real devices.

UPDATE If you still want to see console logs and other debug information, you can access these in Logcat inside Android Studio without sacrificing performance.

UPDATE 2 I have switched the an M1 Mac which runs on ARM architecture and the emulator is incredibly fast now. If you're going to be doing a lot of React Native development on a Mac I'd recommend getting an M1 Mac!

0
2

It would help if you posted something about your hardware and setup, or at least, what emulator API are we talking about. Android 5? 8? 9? What's your hardware? RAM? Where's the screenshot showing your emulator settings?

To begin with, Android emulator has different optimization methods depending on the processor used. If you have installed the emulator using Android SDK tools v24, update the SDK tools to v27 as shown here.

Things to consider first:

  • You must be using latest Android SDK tools version
  • Intel processors require HAXM to run faster
  • AMD processors require Windows Hypervisor Platform enabled
  • Your emulators should have at least 2048 MB of RAM or more
2
  • Added some info. And about API - react native uses API 23, is it safe to update it to 24?..
    – John Smith
    Commented Jul 21, 2018 at 20:58
  • Sorry, I can't provide more feedback for react native. If this problem does not happen on the device, then you shouldn't worry too much for the emulator's issues anyway, but I know it's frustrating.
    – andreszs
    Commented Jul 22, 2018 at 20:01
0

I delete avd foulder in c:/user//.android/avd and create new device in emulator and type

npx react-native start 

and after that

react-native run-android

and solve my problem

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