初次运行Android报错Connect to 127.0.0.1:7890 [/127.0.0.1] failed: Connection refused (Connection refused)
2021-12-02 15:55:21
在下载好各种依赖及启动虚拟机后,运行android app, 在build过程中会报错 connect fail,log中会有错误信息例如:
“Could not resolve all files for configuration ':app:_internal_aapt2_binary'.”
“Connect to 127.0.0.1:7890 [/127.0.0.1] failed: Connection refused (Connection refused)”
查了一些文章,做了三处修改,不确定是哪个生效了,大家可以挨个试一下。
1. 修改build.gradle中的配置
初次创建工程时,build.gradle中默认为:
buildscript {
repositories {
google()
jcenter()
dependencies {
classpath "com.android.tools.build:gradle:4.1.2"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
allprojects {
repositories {
google()
jcenter()
参考网上大家分享的修改,把jcenter()注释掉后增加了一些maven地址,如下
buildscript {
repositories {
google()
//jcenter()
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'https://maven.aliyun.com/repository/public/' }
maven { url 'https://maven.aliyun.com/repository/google/' }
maven { url 'https://maven.aliyun.com/repository/jcenter/' }
maven { url 'https://maven.aliyun.com/repository/central/' }
dependencies {
classpath "com.android.tools.build:gradle:4.1.2"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
allprojects {
repositories {
google()
//jcenter()
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
根据as的弹窗提示选择“sync now”,会重新下载很多包。
2. 关掉proxy setting
做完第一步之后build还是会报错,彻底关掉as之后,重新打开,在HTTP Proxy设置中将“Auto-dectect proxy settings" 切换为 “No proxy".
3. 注释掉自动生成的proxyhost和proxyport配置
第三步做完就,BUILD SUCCESSFUL啦!
npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t https://github.com/nhn/raphael.git
npm ERR!
npm ERR! fatal: unable to access 'https://github.com/nhn/raphael.git/': Failed connect to github.com:443; Connection timed out
这种错误大多是因为本地代理引起的,网上很多人都说将.gradle下面的.properties文件里面的代理删掉就行,但是我看了看,根本没有那个文件呀,这里我就说说我得解决方法吧。
我认为呢这种情况可能是我们开启了本地端口,通过本地端口去load pom文件,所以呢我就直接去看了看我开启的端口,mac下面直接就lsof -i就能全部看到
解决git报错:fatal: unable to access 'xxx/': Failed to connect to 127.0.0.1 port 7890: Connection refused
Connect to 127.0.0.1:7890 [/127.0.0.1] failed: Connection refused (Connection refused)
Android studio 有时回报这个错,
解决方法:删除.gradle,然后重启studio。即可
wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtrainval_06-Nov-2007.tar
–2021-06-21 11:28:10-- http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtrainval_06-Nov-2007.tar
正在连接 127.0.0.1:7890… 失败:拒绝连接。
原因为 export | grep -i proxy
declare
发现是安全拦截导致,因为在安全的IP封禁里面的规则对于别人是不可见的,部分出口防火墙的公网被安全封禁,在开发人员你那边是不清楚底层网络通信被转了几手,中间通过了哪些个节点,所以可以询问下网络同事。权限无问题,请检查应用。步骤1、在x.x.x.1上:ping x.x.x.2,查看是否有丢包(packet loss),1%以上确认中间网络的链路就有丢包故障。步骤2:在x.x.x.1上:telnet x.x.x.2 80,查看response速度,正常应该是瞬间返回,人为几乎感知不到延迟。
* What went wrong:
Could not resolve all files for configuration ':utils:debugCompileClasspath'.
> Could not download design.aar (com.android.support:desig...