当我尝试构建并运行基本的react-native testapp时,批处理过程总是下载大量的组件。这花费了大量的时间,似乎浪费了时间和带宽。
如何简单地使用这些组件的缓存或现有副本而不是一直从头开始下载?
我按照Windows 7上的文档中的描述设置了本地反应。
例如:
C:\Users\C3\Documents\ReactNativeProjects\AwesomeProject>react-native run-android
Starting JS server...
Building and installing the app on the device (cd android && gradlew.bat install
Debug...
Downloading https://services.gradle.org/distributions/gradle-2.10-all.zip
................................................................................
......
Unzipping C:\Users\C3\.gradle\wrapper\dists\gradle-2.10-all\a4w5fzrkeut1ox71xslb49gst\gradle-2.10-all.zip to C:\Users\C3\.gradle\wrapper\dists\gradle-2.10-all\a4w5fzrkeut1ox71xslb49gst
Download jcenter.bintray.com/com/android/tools/build/gradle/2.1.2/gradle-2.1.2.pom
Download jcenter.bintray.com/com/android/tools/build/gradle-core/2.1.2/gradle-core-2.1.2.pom
Download jcenter.bintray.com/com/android/tools/build/builder/2.1.2/builder-2.1.2.pom
Download jcenter.bintray.com/com/android/tools/lint/lint/25.1.2/lint-25.1.2.pom
Download jcenter.bintray.com/com/android/tools/build/transform-api/2.0.0-deprecated-use-gradle-api/transform-api-2.0.0-deprecated-use-gradle-api.pom
Download jcenter.bintray.com/com/android/tools/build/gradle-api/2.1.2/gradle-api-2.1.2.pom
Download jcenter.bintray.com/com/android/databinding/compilerCommon/2.1.2/compilerCommon-2.1.2.pom
Download jcenter.bintray.com/org/ow2/asm/asm-commons/5.0.3/asm-commons-5.0.3.pom
Download jcenter.bintray.com/org/jacoco/org.jacoco.core/0.7.4.201502262128/org.jacoco.core-.7.4.201502262128.pom
Download jcenter.bintray.com/org/jacoco/org.jacoco.build/0.7.4.201502262128/org.jacoco.build-0.7.4.201502262128.pom
Download jcenter.bintray.com/org/antlr/antlr/3.5.2/antlr-3.5.2.pom
等等..........
答案 0 :(得分:0)
此命令将强制重建整个Android项目,因此它会根据等级文件中的依赖项下载库。
如果原生方面没有变化,您只需打开应用程序并运行
即可 npm start
在项目文件夹中,启动打包程序而不重建整个项目。