解决as connection refused: connect错误

简介: 解决as connection refused: connect错误

最近在使用AndroidStudio时遇到了connection refused: connect问题,困扰了很久终于找到了一个比较完美得解决方案,现在分享给大家,下面是解决步骤。

步骤1

正常遇到这个问题都是跟网络代理有关系,所以先在as的设置页里把代理关了试试。

image.png

步骤2

通常只执行步骤1是不管用的,还需要把本地gradle.properties文件的代理信息去掉。gradle.properties文件的路径默认是C:\Users\用户名\ .gradle。

image.png

步骤3

正常执行到步骤2重新同步下应该就能解决问题了。但是我遇到了很多次把设置页和gradle.properties文件件去掉代理还是不行的情况,看了下错误信息as仍然会用代理的地址去同步,我用的android studio的版本是3.5,不知道是不是3.5的bug。所以遇到这种情况解决办法就是直接把gradle.properties文件删除,然后再同步就可以了。

image.png

步骤4

如果经历了前3个步骤还是不行的话,正常就是网络问题了,可以通过阿里镜像来同步依赖,在根项目的build.gradle文件添加如下代码。

repositories {
    maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
    ........
}
相关文章
|
8天前
|
NoSQL 网络安全 Redis
redis.exceptions.ConnectionError: Error 111 connecting to 127.0.0.1:6379. Connection refused.
当使用Python连接Redis遇到"ConnectionError: Error 111"时,可能的原因包括Redis未启动、非默认端口监听、防火墙阻拦、配置错误或Redis模块安装不正确。解决方法包括启动Redis、检查端口与防火墙设置、修正配置文件、确保模块正确安装及测试服务器功能。提供了一个Python连接Redis的示例代码,根据实际情况调整IP和端口,以诊断连接问题。
58 0
|
8天前
|
Go 开发工具 git
【git】解决:Failed to connect to 127.0.0.1 port 7890: Connection refused
【git】解决:Failed to connect to 127.0.0.1 port 7890: Connection refused
622 0
|
9月前
|
NoSQL Redis 开发工具
redisCould not connect to Redis at 127.0.0.16379 Connection refused错误解析
redisCould not connect to Redis at 127.0.0.16379 Connection refused错误解析
85 0
|
9月前
|
网络协议 Linux 网络安全
使用frp时遇到的问题connect: connection refuseddial tcp xxxx:7000: connect: connection refused
最近在做的项目需要用到frp来做代理连接本地内网机,卡在最后启动客户端的时候,提示报错:login to server failed: dial tcp xxxx:7000: connect: connection refuseddial tcp xxxx:7000: connect: connection refused!!找了很多尝试的办法,现在给大家列一下希望对大家有帮助。
1763 0
|
运维 网络协议 网络安全
Closed socket connection for client /39.103.162.230:56100 (no session established for client)
Closed socket connection for client /39.103.162.230:56100 (no session established for client)
360 0
Closed socket connection for client /39.103.162.230:56100 (no session established for client)
Failed to connect to 127.0.0.1 port 1080: Connection refused package 问题解决方法
Failed to connect to 127.0.0.1 port 1080: Connection refused package 问题解决方法
694 0
Failed to connect to 127.0.0.1 port 1080: Connection refused package 问题解决方法
|
Linux 测试技术 网络安全
VNC connect:Connection refused(10061)
在Windows机器上使用VNC Viewer访问Linux服务器,有时候会遇到"connect:Connection refused(10061)"这个错误,导致这个错误出现的原因有多重,下面总结一下:     1:使用VNC Viewer时忘记加桌面号(一般为IP:桌面号,桌面号要看你自己的配置而定。
4236 0

热门文章

最新文章