react-native-vision-camera
react-native-vision-camera copied to clipboard
Why everytime i run `react-native run-android` i need to download an enormous tar in `:downloadGlog` task❓
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
- [ ] I am using Expo
- [X] I have read the Troubleshooting Guide
- [X] I agree to follow this project's Code of Conduct
- [X] I searched for similar questions in the issues page as well as in the discussions page and found none.
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...
我也遇到了和你一样的问题,查了相关资料,然后在/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
我也遇到了和你一样的问题,查了相关资料,然后在/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)
Gradle 7.0 不支持这项设置 android.enableBuildCache = true 需要删除
Gradle 7.0 不支持这项设置 android.enableBuildCache = true 需要删除
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?
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 is really too slow to download
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
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 :(
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
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/
I'm not familiar with scripts, but your workaround is helpful too, thanks for posting it here!
Still an issue.
@SectionTN Your hack suggestion works here out of box! Tks!
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!
Hello, this is still an issue in 2023, are we expecting an update?, is the matter being investigated?
Can we look into this issue, or have a workaround. It takes 45-55 mins to run react-native run-android
Is this being looked into?
jusst remove it and it works for me 0_0
react-native-reanimated
had this problem once, they seems to fixed it in next version https://github.com/software-mansion/react-native-reanimated/issues/3523
maybe we can use their approach to fix this
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 :
-
android
"android": "react-native run-android && chmod +x ./scripts/copy-gradle-things.sh && ./scripts/copy-gradle-things.sh run"
-
posiinstall
"postinstall": "chmod +x ./scripts/copy-gradle-things.sh && ./scripts/copy-gradle-things.sh install"
-
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
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
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.