?報(bào)錯(cuò)提示如下
1、下載不下來、下載超時(shí)。?
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':react-native-safe-area-context'.
> Could not resolve all files for configuration ':react-native-safe-area-context:classpath'.
> Could not download kotlin-compiler-embeddable-1.6.20.jar (org.jetbrains.kotlin:kotlin-compiler-embeddable:1.6.20)
> Could not get resource 'https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-compiler-embeddable/1.6.20/kotlin-compiler-embeddable-1.6.20.jar'.
> Could not GET 'https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-compiler-embeddable/1.6.20/kotlin-compiler-embeddable-1.6.20.jar'.
> Connect to repo.maven.apache.org:443 [repo.maven.apache.org/151.101.108.215, repo.maven.apache.org/2a04:4e42:1a:0:0:0:0:215] failed: No route to host (connect failed)
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 19m 54s
error Failed to install the app.
info Run CLI with --verbose flag for more details.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
?2、下載極慢,基本就是幾KB的在慢慢下載。
<==========---> 81% CONFIGURING [9m 32s]
> :react-native-safe-area-context > Resolve files of :react-native-safe-area-context:classpath > kotlin-compiler-embeddable-1.6.20.jar > 4.8 MiB/49.5 MiB downloaded
^Z
zsh: suspended yarn android
?解決方案
就以報(bào)錯(cuò)提示來看,提供的下載jar壓縮包的鏈接,丟到瀏覽器也是很難下載的。
但是,我們可以換個(gè)倉庫去下載
https://mvnrepository.com/
1、瀏覽器打開上面的鏈接
2、輸入框搜索你下載不下來的依賴包包名,比如我這里是?kotlin-compiler-embeddable?
3、點(diǎn)進(jìn)去查看詳情
Google 和 Central 就是項(xiàng)目目錄 android/build.gradle 里面的?google()?和?mavenCentral() 下載源。我們在這兩個(gè)選項(xiàng)里面找到報(bào)錯(cuò)或者下載慢的版本進(jìn)入詳情。
4、找到對應(yīng)的版本查看詳情。這個(gè)網(wǎng)站Tab切換選中效果不明顯,以標(biāo)記出來了。
?5、點(diǎn)擊這個(gè)位置下載 jar 壓縮包。
6、打開文件夾進(jìn)入下面的文件路徑。默認(rèn)是在這個(gè)路徑下面,如果你沒有這個(gè)路徑,自行百度你的 gradle 依賴包存放位置。
/Users/你的電腦名/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-compiler-embeddable
因下載報(bào)錯(cuò)、或者下載慢,都會(huì)在??kotlin-compiler-embeddable 文件夾下有 1.6.20 的版本號文件夾,版本號文件夾下有類似?18f66cca4301c12893ebe4ef47d65c3d9d2bff9b 的文件夾。
進(jìn)到這個(gè)一串字符串的文件夾,然后把剛剛下載下來的 jar 依賴包丟到里面去。
然后在項(xiàng)目目錄下 重新執(zhí)行?文章來源:http://www.zghlxwxcb.cn/news/detail-785909.html
yarn android
其他依賴包類似。注意包名!??!文章來源地址http://www.zghlxwxcb.cn/news/detail-785909.html
到了這里,關(guān)于React-Native: Android 編譯過程中 gradle 依賴包下載各種下載不下來、下載超時(shí)、極慢下載的處理方案。的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!