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

Why everytime i run react-native run-android i need to download an enormous tar in :downloadGlog task❓ #1148

Closed
3 of 4 tasks
hkar19 opened this issue Jul 17, 2022 · 24 comments
Labels
💭 question Further information is requested

Comments

@hkar19
Copy link

hkar19 commented Jul 17, 2022

Question

this particular task is making my build time so long and uses enormous data to download:

> Task :react-native-vision-camera:downloadGlog
Download https://github.com/google/glog/archive/v0.3.5.tar.gz
<===========--> 90% EXECUTING [1m 29s]
> IDLE
> :react-native-vision-camera:downloadBoost > boost_1_76_0.tar.gz > 7.99 MB/124.24 MB downloaded
> IDLE
> IDLE
> IDLE
> IDLE

is there any way i can mitigate this such as no need to download when i already have it in my machine?

Edit: apparently it will always download after i installed new package, and everything redownloaded again

What I tried

No response

VisionCamera Version

2.13.5

Additional information

@hkar19 hkar19 added the 💭 question Further information is requested label Jul 17, 2022
@mrousavy
Copy link
Owner

Hi!

I know, that's annoying. Maybe this could be fixed with RN 0.69 as RN is included as source there? Would be great if someone could take a look that has experience with Gradle...

@xyylb
Copy link

xyylb commented Jul 23, 2022

我也遇到了和你一样的问题,查了相关资料,然后在/android/gradle.properties尾部增加了以下设置,后面构建速度快了不少

开启编译缓存

org.gradle.caching=true

构建缓存

android.enableBuildCache = true

分配更大的内存

org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8

开启并行

org.gradle.parallel=true

守护进程

Gradle 是基于 JVM 的构建系统,JVM 的启动和初始化需要时间,开启 Gradle Daemon 守护进程可以节省这些时间

org.gradle.daemon = true

按需配置

org.gradle.configureondemand=true

@hkar19
Copy link
Author

hkar19 commented Jul 25, 2022

我也遇到了和你一样的问题,查了相关资料,然后在/android/gradle.properties尾部增加了以下设置,后面构建速度快了不少

开启编译缓存

org.gradle.caching=true

构建缓存

android.enableBuildCache = true

分配更大的内存

org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8

开启并行

org.gradle.parallel=true

守护进程

Gradle 是基于 JVM 的构建系统,JVM 的启动和初始化需要时间,开启 Gradle Daemon 守护进程可以节省这些时间

org.gradle.daemon = true

按需配置

org.gradle.configureondemand=true

can you please explain in english?

i tried using google translate to understand your reply, and applied it in my gradle.

this is what i got

A problem occurred evaluating project ':app'.
> Failed to apply plugin 'com.android.internal.application'.
   > The option 'android.enableBuildCache' is deprecated.
     The current default is 'false'.
     It was removed in version 7.0 of the Android Gradle plugin.
     The Android-specific build caches were superseded by the Gradle build cache (https://docs.gradle.org/current/userguide/build_cache.html)

@xyylb
Copy link

xyylb commented Jul 25, 2022

Gradle 7.0 不支持这项设置 android.enableBuildCache = true 需要删除

1 similar comment
@xyylb
Copy link

xyylb commented Jul 25, 2022

Gradle 7.0 不支持这项设置 android.enableBuildCache = true 需要删除

@hkar19
Copy link
Author

hkar19 commented Jul 25, 2022

Gradle 7.0 不支持这项设置 android.enableBuildCache = true 需要删除

so i applied everything you suggested, but i commented on
org.gradle.caching=true and android.enableBuildCache = true as both are deprecated.

my gradle task still do the dowloadBooster everytime i installed new module.

is there a workaround for Gradle 7.0?

@SectionTN
Copy link

Temporarily Workaround:

  • Go to node_modules/react-native-vision-camera/android/build/downloads
  • Copy all *.tar.gz to a safe folder like /home/${yourUsername}/gradleThings
  • When you install a new library and you know that gradle will download glog again, just copy them from the safe folder.
  • Gradle should found and extract them as he do always!

@Tzng
Copy link

Tzng commented Aug 22, 2022

This is really too slow to download

@SectionTN
Copy link

Temporarily Workaround:

  • Go to node_modules/react-native-vision-camera/android/build/downloads
  • Copy all *.tar.gz to a safe folder like /home/${yourUsername}/gradleThings
  • When you install a new library and you know that gradle will download glog again, just copy them from the safe folder.
  • Gradle should found and extract them as he do always!

this workaround working for me

@agostinhodev
Copy link

I'm facing the same problem here. Every time I run expo run:android for the first time, the speed is so fast! However, if I need to install a native package and run the same command again, it turns so slow. I believe that they restrict the download according your IP if you run this command for several times. I tried again using other VPN IP and it runs so fast. But it's so boring to do every time you need to build your app :(

@mandeepsingh-byjus
Copy link

Temporarily Workaround:

  • Go to node_modules/react-native-vision-camera/android/build/downloads
  • Copy all *.tar.gz to a safe folder like /home/${yourUsername}/gradleThings
  • When you install a new library and you know that gradle will download glog again, just copy them from the safe folder.
  • Gradle should found and extract them as he do always!

this workaround working for me

This worked for me even for react-native-reanimated
Thanks @SectionTN for adding here, even it is a hack but saves a lot of time while build

@Orange9000
Copy link

Temporarily Workaround:

  • Go to node_modules/react-native-vision-camera/android/build/downloads
  • Copy all *.tar.gz to a safe folder like /home/${yourUsername}/gradleThings
  • When you install a new library and you know that gradle will download glog again, just copy them from the safe folder.
  • Gradle should found and extract them as he do always!

You may also add it as a script to your package.json

For example:
cp /Users/{{your username}}/projs/boost_1_76_0.tar.gz /Users/{{your username}}/projs/{{your project folder}}/node_modules/react-native-vision-camera/android/build/downloads/

@SectionTN
Copy link

I'm not familiar with scripts, but your workaround is helpful too, thanks for posting it here!

@heydavee
Copy link

heydavee commented Nov 9, 2022

Still an issue.

@agostinhodev
Copy link

@SectionTN Your hack suggestion works here out of box! Tks!

@josej14
Copy link

josej14 commented Dec 5, 2022

React-native-reanimated faced the same issue (ref here). They resolved this with these code changes. Please, let us know if you're planning a new release with a fix soon to skip an additional script/patch on our app. Thanks!

@Jaybee4real
Copy link

Hello, this is still an issue in 2023, are we expecting an update?, is the matter being investigated?

@jimitshah-dp
Copy link

Can we look into this issue, or have a workaround.
It takes 45-55 mins to run react-native run-android

@bhavzie
Copy link

bhavzie commented Feb 11, 2023

Is this being looked into?

@docvhcmc
Copy link

jusst remove it and it works for me 0_0

@vanenshi
Copy link
Contributor

react-native-reanimated had this problem once, they seems to fixed it in next version software-mansion/react-native-reanimated#3523

maybe we can use their approach to fix this

@leiMsnow
Copy link

Temporarily Workaround:

  • Go to node_modules/react-native-vision-camera/android/build/downloads
  • Copy all *.tar.gz to a safe folder like /home/${yourUsername}/gradleThings
  • When you install a new library and you know that gradle will download glog again, just copy them from the safe folder.
  • Gradle should found and extract them as he do always!

thanks, it's working for me, i added a scripts to automate these copy operations:

change package.json scripts :

  1. android
    "android": "react-native run-android && chmod +x ./scripts/copy-gradle-things.sh && ./scripts/copy-gradle-things.sh run"

  2. posiinstall
    "postinstall": "chmod +x ./scripts/copy-gradle-things.sh && ./scripts/copy-gradle-things.sh install"

  3. add copy-gradle-things.sh


#!/bin/bash

echo "copy gralde ache files: $1"

if [ "$1" = "run" ]
then
  echo "start copy gradle cache to localfile"
  mkdir -p gradleThings/react-native-vision-camera
  cp -r ./node_modules/react-native-vision-camera/android/build/downloads/ ./gradleThings/react-native-vision-camera/
fi

if [ "$1" = "install" ]
then
  echo "start copy localfile cache to gradle"
  cp -r ./gradleThings/react-native-vision-camera/ ./node_modules/react-native-vision-camera/android/build/downloads/
fi

@sheltonsuen
Copy link

sheltonsuen commented Jul 13, 2023

This issue has been fixed by the #1306, and you can define a env: REACT_NATIVE_DOWNLOADS_DIR to change the downlaod dir to a global place so that it will not downlaod every time you run.

By the way, although the v3-rc will not have this kind of problem, but it's still in rc and will only support ios for now, think twice before you upgrade

@mrousavy
Copy link
Owner

Closing as this is a stale issue - this might have been fixed with the full rewrite in VisionCamera V3 (🥳) - if not, please create a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💭 question Further information is requested
Projects
None yet
Development

No branches or pull requests