React Native 打包异常:Connect to maven.google.com failed: connect timed out(原创)
异常原文:
FAILURE: Build failed with an exception. * What went wrong: Could not determine the dependencies of task ':react-native-fast-image:generateReleaseRFile'. > Could not resolve all task dependencies for configuration ':react-native-fast-image:releaseRuntimeClasspath'. > Could not resolve com.facebook.react:react-native:+. Required by: project :react-native-fast-image > Failed to list versions for com.facebook.react:react-native. > Unable to load Maven meta-data from https://maven.google.com/com/facebook/react/react-native/maven-metadata.xml. > Could not get resource 'https://maven.google.com/com/facebook/react/react-native/maven-metadata.xml'. > Could not GET 'https://maven.google.com/com/facebook/react/react-native/maven-metadata.xml'. > Connect to maven.google.com:443 [maven.google.com/216.58.200.238] failed: connect timed out * 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 Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warnings BUILD FAILED in 17m 47s
解决方案:
找这个插件的位置(../node_modules/react-native-fast-image),修改./android/build.gradle的maven地址:
repositories { mavenCentral() google() maven { url "http://maven.aliyun.com/nexus/content/groups/public/" # 原先是:maven.google.com } }
gradle clean后重新打包即可。
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· [.NET]调用本地 Deepseek 模型
· Blazor Hybrid适配到HarmonyOS系统
· Obsidian + DeepSeek:免费 AI 助力你的知识管理,让你的笔记飞起来!
· 分享4款.NET开源、免费、实用的商城系统
· 解决跨域问题的这6种方案,真香!
· 一套基于 Material Design 规范实现的 Blazor 和 Razor 通用组件库