Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React native run android terribly slow #27898

Closed
1nfinite opened this issue Jan 29, 2020 · 21 comments
Closed

React native run android terribly slow #27898

1nfinite opened this issue Jan 29, 2020 · 21 comments
Labels
DX Issues concerning how the developer experience can be improved. Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Platform: Android Android applications.

Comments

@1nfinite
Copy link

1nfinite commented Jan 29, 2020

I have a decent working laptop here. But the build speed seems to be intolerable to me.
It takes me around 3 minutes for a debug mode build in android and 7 minutes for release mode build in android for my application. Was it a matter related to certain release of react-native or nodejs? Or what exactly causes the slow build?

The app does not have hermes/proguard enabled. It's the similar timing despite i build on simulator/real device.

At least it doesn't seem "OK" for me. 3 minutes compilation is already long and 7 minutes compilation is very ridiculous to me.

Note: Mind to share what build time u all use as well?

1) npx react-native run-android (takes 3 minutes)
2) npx react-native run-android --variant=release (takes 7 minutes)

React Native version:
System:
OS: Windows 10 10.0.18363
CPU: (8) x64 Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
Memory: 15.41 GB / 31.88 GB
Binaries:
Node: 12.9.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.21.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.10.2 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: Version 3.5.0.0 AI-191.8026.42.35.6010548
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.5 => 0.61.5

Steps To Reproduce

  1. npx react-native run-android (takes 3 minutes)
  2. npx react-native run-android --variant=release (takes 7 minutes)

Describe what you expected to happen:

  • Expect to takes around 1-2 minutes at most
@1nfinite 1nfinite added the Bug label Jan 29, 2020
@react-native-bot react-native-bot added the Platform: Android Android applications. label Jan 29, 2020
@hramos hramos added Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. DX Issues concerning how the developer experience can be improved. and removed Bug labels Jan 30, 2020
@gromanas
Copy link

gromanas commented Jan 30, 2020

On a Mac pro and for our project it takes almost 10 min for a release build on android with react 0.61.4 and on debug it takes only 1min and 30 sec

@gromanas
Copy link

gromanas commented Jan 30, 2020

I have found this issue #27057 saying that if you add in build.gradle hermesFlagsRelease: [], the time will be significantly reduced. I have tried and the time now for a release build is reduced to 2 mins. Also if you flag enableHermes: in build.gradle as false again the time has been reduced to 3 mins. I saw also that the size of the .apk has began about ~10 MB higher if you use one of those two workarounds.

@samgermain
Copy link

@gromanas What block does this go in inside build.gradle, and I'm guessing you mean android/build.gradle?

@steinathan
Copy link

am having this issue, npx react-native run-android --verbose --no-jetifier takes a tremendous amount of time to compile and expo start is fucking up with mixed port (can't use it either) :(

@nikhil026
Copy link

@gromanas What block does this go in inside build.gradle, and I'm guessing you mean android/build.gradle?

You have to do changes in android/app/build.gradle, By default, the configuration is already present in the former file as a comment. You can check the docs here to make changes: https://reactnative.dev/docs/hermes

@stale
Copy link

stale bot commented Sep 20, 2020

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Sep 20, 2020
@Piyush132000
Copy link

<============-> 99% EXECUTING [27m 16s]

Transforming artifact jsr305-3.0.2.jar (com.google.code.findbugs:jsr305:3.0.2) with JetifyTransform
Transforming artifact lifecycle-livedata-2.0.0.aar (androidx.lifecycle:lifecycle-livedata:2.0.0) with JetifyTransform
Transforming artifact appcompat-resources-1.1.0.aar (androidx.appcompat:appcompat-resources:1.1.0) with AarToClassTran
Transforming artifact vectordrawable-animated-1.1.0.aar (androidx.vectordrawable:vectordrawable-animated:1.1.0) with A
Transforming artifact fragment-1.1.0.aar (androidx.fragment:fragment:1.1.0) with AarToClassTransform
Transforming artifact viewpager-1.0.0.aar (androidx.viewpager:viewpager:1.0.0) with JetifyTransform
PS C:\Users\nites\MyApp> npx react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 967 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
info Installing the app...

Task :app:stripDebugDebugSymbols UP-TO-DATE
Compatible side by side NDK version was not found.
<============-> 99% EXECUTING [10m 17s]
IDLE
IDLE
IDLE
:app:installDebug
IDLE
IDLE
IDLE
IDLE

see this its take too long time and there is no answer please help me

@ollirytkonen
Copy link

<============-> 99% EXECUTING [27m 16s]

Transforming artifact jsr305-3.0.2.jar (com.google.code.findbugs:jsr305:3.0.2) with JetifyTransform
Transforming artifact lifecycle-livedata-2.0.0.aar (androidx.lifecycle:lifecycle-livedata:2.0.0) with JetifyTransform
Transforming artifact appcompat-resources-1.1.0.aar (androidx.appcompat:appcompat-resources:1.1.0) with AarToClassTran
Transforming artifact vectordrawable-animated-1.1.0.aar (androidx.vectordrawable:vectordrawable-animated:1.1.0) with A
Transforming artifact fragment-1.1.0.aar (androidx.fragment:fragment:1.1.0) with AarToClassTransform
Transforming artifact viewpager-1.0.0.aar (androidx.viewpager:viewpager:1.0.0) with JetifyTransform
PS C:\Users\nites\MyApp> npx react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 967 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
info Installing the app...

Task :app:stripDebugDebugSymbols UP-TO-DATE
Compatible side by side NDK version was not found.
<============-> 99% EXECUTING [10m 17s]
IDLE
IDLE
IDLE
:app:installDebug
IDLE
IDLE
IDLE
IDLE

see this its take too long time and there is no answer please help me

I think its normal for the first time you build your app that it takes some time. Mine takes 10-20 minutes at the first build.

@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Sep 29, 2020
@Piyush132000
Copy link

Piyush132000 commented Sep 29, 2020 via email

@DivyaVaniChinta
Copy link

Hi,

I am also facing same issue. Two days I spent to solve this issue in different ways . Kindly someone help me that how to reduce the app deployment time (which takes 1 hr 55 mins) in Android.
1hr

Thank you.

@BokiGaja
Copy link

Facing the same issue

Screenshot 2021-07-26 at 14 47 51

@BokiGaja
Copy link

I managed to fix this by following these instructions:
https://onesignal.com/blog/android-migrate-jcenter-to-maven-central/

@jaskaran-online
Copy link

I managed to fix this by following these instructions:
https://onesignal.com/blog/android-migrate-jcenter-to-maven-central/

Thanks, This work for me

@nareshOpenxcell
Copy link

I managed to fix this by following these instructions:
https://onesignal.com/blog/android-migrate-jcenter-to-maven-central/

This link didn't work for me. I am facing this same issue.
In my older system it was working fine and builds took 2-4 mins. After changing my system, the build time for old projects that are imported from gitlab takes more than 2 hours to build

@buitunglam
Copy link

I managed to fix this by following these instructions:
https://onesignal.com/blog/android-migrate-jcenter-to-maven-central/

it's work for me too. using mavenCenter(). reduce time from 1h to 3m

@bkvaiude
Copy link

bkvaiude commented Nov 27, 2021

In my case, it was an android emulator that was not responding state, killing it and rerunning the command solved the problem.

npx react-native run-android

Note: I had the latest setup and have needful changes suggested by other users!

@KarthiArcus
Copy link

To solve this problem update your react Native project new and move your sources and files to it.... its working fine for me

@faerylay
Copy link

faerylay commented Dec 6, 2022

with real device make sure wifi should be same

@gyan-js
Copy link

gyan-js commented May 17, 2023

You guys having 3 mins to 7 mins, in my case it's terrible, it's 13 to 15 mins .

@cortinico
Copy link
Contributor

Closing as after 0.71 we moved a lot of our build logic to use prebuilts. We also leverage caching quite aggressively. I'm able to run run-android in ~15 seconds. Release takes a couple of minutes at most.

We can look at other build issues more closely as they arise.

@norellanac
Copy link

remove /Users/yourusername/.gradle folder
and also remove YourProject/android/.gradle

this works for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX Issues concerning how the developer experience can be improved. Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Platform: Android Android applications.
Projects
None yet
Development

No branches or pull requests