关于android SDK安装Failed to fetch URL http://dl-ssl.google.com/android/repository/addons_list-1.xml出错

本文解决Android SDK加载失败问题,并分享了作者在Android开发过程中的学习心得,强调独立思考和解决问题的重要性。
      最近SDK出问题了,然后在google下载了一个android-sdk-windows.rar,然后点击SDK Manager,结果一直不能刷新API Level,然后就开始在网上找了好多资料,解决这个问题,修改 HOSTS,    HTTP  和  HTTPS  都不能解决,这给我带来了很大的困惑!   加载不出来的界面错误为:


Fetching http://dl-ssl.google.com/android/repository/addons_list-1.xml
Failed to fetch URL http://dl-ssl.google.com/android/repository/addons_list-1.xml, reason: Connection to http://dl-ssl.google.com refused
Fetched Add-ons List successfully
Fetching URL: http://dl-ssl.google.com/android/repository/repository-6.xml
Failed to fetch URL http://dl-ssl.google.com/android/repository/repository-6.xml, reason: Connection to http://dl-ssl.google.com refused
Done loading packages.
Fetching https://dl-ssl.google.com/android/repository/addons_list-1.xml
Failed to fetch URL https://dl-ssl.google.com/android/repository/addons_list-1.xml, reason: Connection to https://dl-ssl.google.com refused
Fetched Add-ons List successfully
Fetching URL: https://dl-ssl.google.com/android/repository/repository-6.xml
Failed to fetch URL https://dl-ssl.google.com/android/repository/repository-6.xml, reason: Connection to https://dl-ssl.google.com refused
Done loading packages.


我就纠结了,一直连接失败,难道是电信把google android屏蔽了,最近有一个想法,电信再怎么屏蔽android  但是不会屏蔽google搜索引擎的,如果电信把google搜索引擎屏蔽了,那电信估计也倒闭了! 呵呵  我就做了一个选择  ,使用www.google.com做代理,详细看截图:

 

然后点击了一个package下的  reload  重新加载,呵呵  结果API level  全部出来了,真的很爽歪歪  ,呵呵  分享给大家,希望给大家有帮助~ 

看了一下自己的评论,蛮多的,很高兴能满足很多朋友。不过本人也折腾android好几年了,说一下自己的一些心得吧:
如果要把android学好,必须要走出自己的路,不然的去独立思考,做不出来就画图,任何绝决不了的问题都是思路或者逻辑没想通的,我曾经很多问题没解决,最后都是逼着自己必须把问题解决,这就是坚持和负责!今天,我已经养成了习惯,养成了不屈不服的心,要知道,如果别人能实现的功能,你肯定也可以,因为你不比别人差多少,只是比别人花费的时间少而已!对自己要有信心,学程序对了一个阶段后,不是写代码,是一个思考的心,这是一种全新的境界,这个境界如果早点到到底人就能把世界看的更透彻!人在不同层次,境界也是不一样的,平静如水的态度,坚持不屈不服的心,将会注定一个人的不凡!一句话,人一定要靠自己,希望大家以后遇到困难都要多思考多尝试!能发现问题是好事,能解决问题更是好事!

----spring sky


顺便说一下,本人年纪不小了,为了能做出自己的一些事情,有点创业的想法,如果有创业的朋友缺忠诚的合作伙伴,请联系我!(专注于android ios开发,没有神一样的智商,但拥有不屈不服的心,不为困难而低头,只为理想而拼搏)

hzk@hzk:~/Desktop/be800v1_12.5sdk/20251014/Iplatform/image/be800v1$ sudo apt update && sudo apt install ubireader-utils [sudo] password for hzk: Ign:1 http://rdsource.tp-link.com/ubuntu jammy InRelease Ign:2 http://packages.microsoft.com/repos/code stable InRelease Ign:3 http://rdsource.tp-link.com/ubuntu jammy-updates InRelease Ign:4 http://rdsource.tp-link.com/ubuntu jammy-backports InRelease Ign:5 http://rdsource.tp-link.com/ubuntu jammy-security InRelease Ign:1 http://rdsource.tp-link.com/ubuntu jammy InRelease Ign:2 http://packages.microsoft.com/repos/code stable InRelease Ign:3 http://rdsource.tp-link.com/ubuntu jammy-updates InRelease Ign:4 http://rdsource.tp-link.com/ubuntu jammy-backports InRelease Ign:5 http://rdsource.tp-link.com/ubuntu jammy-security InRelease Ign:1 http://rdsource.tp-link.com/ubuntu jammy InRelease Ign:2 http://packages.microsoft.com/repos/code stable InRelease Ign:3 http://rdsource.tp-link.com/ubuntu jammy-updates InRelease Ign:4 http://rdsource.tp-link.com/ubuntu jammy-backports InRelease Ign:5 http://rdsource.tp-link.com/ubuntu jammy-security InRelease Err:1 http://rdsource.tp-link.com/ubuntu jammy InRelease Temporary failure resolving 'rdsource.tp-link.com' Err:2 http://packages.microsoft.com/repos/code stable InRelease Temporary failure resolving 'packages.microsoft.com' Err:3 http://rdsource.tp-link.com/ubuntu jammy-updates InRelease Temporary failure resolving 'rdsource.tp-link.com' Err:4 http://rdsource.tp-link.com/ubuntu jammy-backports InRelease Temporary failure resolving 'rdsource.tp-link.com' Err:5 http://rdsource.tp-link.com/ubuntu jammy-security InRelease Temporary failure resolving 'rdsource.tp-link.com' Reading package lists... Done Building dependency tree... Done Reading state information... Done 255 packages can be upgraded. Run 'apt list --upgradable' to see them. W: Failed to fetch http://rdsource.tp-link.com/ubuntu/dists/jammy/InRelease Temporary failure resolving 'rdsource.tp-link.com' W: Failed to fetch http://rdsource.tp-link.com/ubuntu/dists/jammy-updates/InRelease Temporary failure resolving 'rdsource.tp-link.com' W: Failed to fetch http://rdsource.tp-link.com/ubuntu/dists/jammy-backports/InRelease Temporary failure resolving 'rdsource.tp-link.com' W: Failed to fetch http://rdsource.tp-link.com/ubuntu/dists/jammy-security/InRelease Temporary failure resolving 'rdsource.tp-link.com' W: Failed to fetch http://packages.microsoft.com/repos/code/dists/stable/InRelease Temporary failure resolving 'packages.microsoft.com' W: Some index files failed to download. They have been ignored, or old ones used instead. Reading package lists... Done Building dependency tree... Done Reading state information... Done E: Unable to locate package ubireader-utils
最新发布
11-03
<think>我们遇到了两个问题:网络连接问题和无法找到包ubireader-utils。首先,错误信息显示“Temporary failure resolving 'rdsource.tp-link.com'”和“Temporary failure resolving 'packages.microsoft.com'”,这表明DNS解析失败或网络不可达。其次,当尝试安装ubireader-utils时,系统提示“E: Unable to locate package ubireader-utils”,这可能是因为软件源中没有这个包,或者软件源列表未更新成功。 解决方案: 1. 解决网络问题:检查网络连接和DNS配置。 2. 更换软件源:如果内部源不可用,可以临时切换到公共源(如阿里云、清华源等)来安装所需的工具。 3. 尝试其他方法安装ubireader:由于ubireader-utils可能不在官方源中,我们可以通过pip安装Python版本的ubireader。 具体步骤: 步骤1:检查网络连接 - 尝试ping一个公共网站,例如: ping -c 4 baidu.com - 如果无法ping通,检查网络设置(如DNS配置在/etc/resolv.conf)或联系网络管理员。 步骤2:如果网络正常,但内部源不可用,可以临时注释掉内部源,使用公共源。 - 备份源列表: sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak - 编辑源列表: sudo vi /etc/apt/sources.list - 将内部源的条目注释掉(在行首添加#),并添加一个公共源,例如阿里云的Ubuntu源(根据系统版本,这里是jammy,即22.04): deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse - 更新软件包列表: sudo apt update 步骤3:再次尝试安装ubireader工具(注意:公共源中可能也没有ubireader-utils,因为它是第三方工具) - 我们可以安装Python版的ubireader: sudo apt install python3-pip # 如果pip3未安装 pip3 install ubireader 但是,根据之前的错误,如果网络问题还没解决,安装pip3也会失败。因此,如果步骤1中网络有问题,必须先解决网络问题。 如果网络问题无法立即解决,可以采用离线方法: 方法:使用之前提到的Python单行命令(如果已经安装了ubireader,则无需再次安装,但这里显然没有) 但是,如果没有网络,我们无法通过pip安装。所以,我们可以考虑在其他有网络的机器上下载ubireader的wheel文件,然后拷贝过来安装。 步骤: a. 在有网络的机器上,下载ubireader及其依赖: pip3 download ubireader 这会下载多个whl文件。 b. 将whl文件拷贝到目标机器,然后安装: pip3 install --no-index --find-links=/path/to/wheels ubireader 但是,用户当前的需求是检查tp_data.ubi内是否有productinfo.bin,因此我们可以考虑使用不需要安装额外工具的方法。 替代方案:使用dd和字符串搜索(无需安装工具) 步骤: 1. 将UBI镜像转换为可搜索的格式(因为UBI镜像可能包含多个卷,但我们可以尝试直接搜索文件名字符串): strings tp_data.ubi | grep -a "productinfo.bin" 2. 如果输出中包含productinfo.bin,说明该文件在镜像中(但注意,这只能说明文件名存在,并不能保证文件内容完整,但通常可以判断存在性)。 注意:如果文件名在镜像中是以连续字符串存储且未被压缩,这个方法有效。如果被压缩或加密,则无效。 另一种方法:使用ubinfo和ubireader_extract_files需要依赖,如果无法安装,我们可以考虑使用docker容器(如果系统安装了docker)来避免环境问题,但前提是网络可用。 考虑到用户当前网络问题,推荐先用字符串搜索的方法。 总结当前情况下的最简操作: 由于网络问题导致无法安装工具,建议: 1. 先尝试修复网络(检查DNS,例如修改/etc/resolv.conf,添加nameserver 8.8.8.8) 2. 如果无法修复网络,则使用字符串搜索: strings tp_data.ubi | grep "productinfo.bin" 如果网络可以修复,则按之前的方法安装ubireader,然后使用单行Python命令。 步骤详细: 修复网络: - 编辑resolv.conf:sudo vi /etc/resolv.conf 添加一行:nameserver 8.8.8.8 # 使用Google DNS - 保存后,再次尝试:ping baidu.com 如果网络恢复,则安装: sudo apt update sudo apt install python3-pip pip3 install ubireader 然后运行: python3 -c "from ubireader.ubi import ubi; print(any('productinfo.bin' in f.full_path for vol in ubi(open('tp_data.ubi','rb')).volumes for f in vol.files))" 如果网络无法恢复,则使用: strings tp_data.ubi | grep "productinfo.bin" 另外,注意错误中提示有255个包可升级,但当前问题不是主要,可以暂时忽略。 根据用户当前需求(快速检查),建议先尝试简单的字符串搜索。 最终,根据实际情况选择方案。 </think>您的 Linux 系统遇到了两个关键问题:**DNS 解析失败**导致软件源无法访问,以及 **`ubireader-utils` 软件包在源中不存在**。以下是完整解决方案: ### 问题解决步骤 #### 1. **修复 DNS 解析问题**(解决 `Temporary failure resolving` 错误) ```bash # 临时使用 Google DNS(立即生效) echo "nameserver 8.8.8.8" | sudo tee -a /etc/resolv.conf # 永久修复(重启后生效) sudo vi /etc/systemd/resolved.conf # 取消注释并修改为: [Resolve] DNS=8.8.8.8 1.1.1.1 Domains=~. # 保存后执行 sudo systemctl restart systemd-resolved ``` #### 2. **安装替代工具检查 UBI 镜像** ```bash # 安装必要依赖(绕过问题源) sudo apt install -y python3-pip pip3 install --user ubireader # 单行命令检查文件是否存在 python3 -c "from ubireader.ubi import ubi; print('文件存在' if any('/productinfo.bin' in f.full_path for vol in ubi(open('tp_data.ubi','rb')).volumes for f in vol.files) else '文件不存在')" ``` ### 备选方案(无需安装任何工具) ```bash # 方法一:直接字符串搜索(快速但可能漏检) strings tp_data.ubi | grep -m1 "productinfo.bin" && echo "文件存在" || echo "文件不存在" # 方法二:二进制特征检测 (可靠但复杂) hexdump -C tp_data.ubi | grep -E '70|72|6f|64|75|63|74|69|6e|66|6f|2e|62|69|6e' -m3 # 若连续出现70 72 6f...16进制值(即productinfo.bin的ASCII码)则文件存在 ``` > **结果解读**: > - `python3` 命令输出 **"文件存在"** 或 **"文件不存在"** > - `strings` 命令检测到文件名即表示存在 > - `hexdump` 连续匹配 `p r o d u c t i n f o . b i n` 的16进制值即存在
评论 104
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值