React Native 运行 Android 版本需要的时间太长。

4

我在使用Windows,并且已经使用react-native两周了。但是现在,在我的设备上运行应用程序需要太长时间。

Scanning 835 folders for symlinks in D:\workspace\react-
native\MonCompte\node_modules (31ms)
Starting JS server...
Building and installing the app on the device (cd android && gradlew.bat 
installDebug)...
> Configuring > 3/5 projects > Resolving dependencies ':app:_debugApk' > 
Resolving dependencies ':react-native-vector-icons:_releaseCompile'

在这一点上,它似乎会“冻结”。经过25分钟以上的时间,它最终构建成功!

有人有什么想法吗?谢谢!


你的电脑配置是什么? - Sagar Khatri
i5-6500 3.20Ghz / 8Go RAM / Windows 10。但昨天运行它只需要不到1分钟。 - Steven Klinger
尝试清除Watchman缓存。watchman watch-del-all - Priyesh Kumar
没有为Windows提供看门人。(我尝试过一个alpha版本,但它不起作用) - Steven Klinger
有什么想法吗?我还是找不到解决办法。 - Steven Klinger
3个回答

5

我终于找到了解决方案。

原来是因为我的代理没有在gradle.properties文件中设置!

systemProp.http.proxyHost=http://myproxy.proxy
systemProp.http.proxyPort=8080
systemProp.https.proxyHost=http://myproxy.proxy
systemProp.https.proxyPort=8080

这个解决方案能否在Linux上应用? - Charles
如何在哪里应用这个? - Khadam Ikhwanus

0
请确保以下代码行未包含在android/build.gradle文件中:
maven { url 'https://dl.bintray.com/android/android-tools' }
maven { url 'https://dl.bintray.com/firebase/gradle/' }

如果它包含了它们,那么删除或者仅仅注释掉这些行。

0

我发现我没有连接到模拟器,所以我关闭了模拟器和Android Studio应用程序,并重新运行它。react-native run-android 重新启动了它,然后安装速度就像以前一样快。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接