RN工程运行时一直提示react-native-gesture-handler拉取连接超时,后面发现是之前不小心配置的全局代理在作妖!!!
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 897 file(s) to forward-jetify. Using 4 workers...
info Starting JS server...
info Installing the app...
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:mergeDebugAssets'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
> Could not resolve com.facebook.react:react-native:+.
Required by:
project :app
project :app > project :react-native-gesture-handler
> Failed to list versions for com.facebook.react:react-native.
> Unable to load Maven meta-data from https://jcenter.bintray.com/com/facebook/react/react-native/maven-metadata.xml.
> Could not get resource 'https://jcenter.bintray.com/com/facebook/react/react-native/maven-metadata.xml'.
> Could not GET 'https://jcenter.bintray.com/com/facebook/react/react-native/maven-metadata.xml'.
> Connect to 10.118.60.xx:2xxx [/10.118.60.11] 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
BUILD FAILED in 1m 35s
原因
配置了全局代理,而这个全局代理取不到"react-native-gesture-handler"对应的依赖资源
配置全局代理的原因是,手贱在AndroidStudio配置了HTTP Proxy代理后,会默认配置全局代理(神坑!!!).所以我在AndroidStudio里选了No proxy依然没用.依然用的10.118.60.xx:2xxx 这时打开全局代理把相关的代理全部注释掉,OK了!!!
全局代理的位置Macintosh HD ▸ 用户 ▸ userName ▸ .gradle