React Native工程运行时下载gradle超时问题

React Native工程在运行Android的时候会下载gradle,但是由于众所周知的问题,总是下载失败,这时可以通过修改 <APP_ROOT>/android/wrapper/gradle-wrapper.properties 文件中 distributionUrl 参数使用国内 gradle 镜像来提高下载速度。

下面是国内的两个镜像,可以找到自己需要的gradle版本,然后替换 <APP_ROOT>/android/wrapper/gradle-wrapper.properties 文件中 distributionUrl 参数。

比如,下面是我工程下 <APP_ROOT>/android/wrapper/gradle-wrapper.properties 文件原内容

shell 复制代码
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

修改后内容

shell 复制代码
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-8.6-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

然后重新运行 npm start。

相关推荐
星空222313 分钟前
鸿蒙跨平台实战day49:React Native在OpenHarmony上的Font字体降级策略详解
react native·华为·harmonyos
星空222318 分钟前
鸿蒙跨平台实战day48:React Native在OpenHarmony上的Font字体加载管理详解
react native·华为·harmonyos
星空222321 分钟前
鸿蒙跨平台实战day46:React Native在OpenHarmony上的AccessibilityInfo无障碍检测
react native·react.js·harmonyos
编程之路从0到110 小时前
ReactNative新架构之iOS端TurboModule源码剖析
react native·ios·源码阅读
lbb 小魔仙14 小时前
鸿蒙跨平台实战:React Native在OpenHarmony上的AccessibilityInfo无障碍检测
react native·华为·harmonyos
lbb 小魔仙21 小时前
鸿蒙跨平台实战:React Native在OpenHarmony上的Font字体降级策略详解
react native·华为·harmonyos
wayne2141 天前
重磅!React Native 0.84 发布:默认开启 Hermes V1 与 iOS 预编译,构建速度起飞!
react native
lbb 小魔仙1 天前
鸿蒙跨平台实战:React Native在OpenHarmony上的Font字体加载管理详解
react native·华为·harmonyos
lbb 小魔仙1 天前
鸿蒙跨平台实战:React Native在OpenHarmony上的Font自定义字体注册详解
react native·华为·harmonyos
lbb 小魔仙1 天前
鸿蒙跨平台实战:React Native在OpenHarmony上的PixelFormat图片格式处理
react native·华为·harmonyos