I/O errorERROR: dump failed because no AndroidManifest.xml found

文章讲述了在使用AndroidSDK的aapt.exe工具分析APK时遇到的错误,原因是路径中含有中文。解决方法是避免中文路径并使用统一的编码,确保AndroidManifest.xml存在。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、问题概述?

今天通过Android sdk中自带的aapt.exe工具分析apk的时候报错了,报错信息如下:

G:\InstallSoftDirectory\Android\android-sdk\build-tools\29.0.3>aapt.exe dump badging C:\Users\Administrator\Desktop\自动化测试相关资源\百度.apk
W/ziparchive(10324): Unable to open 'C:\Users\Administrator\Desktop\自动化测试相关资源\百度.apk': Illegal byte sequence
W/zipro   (10324): Error opening archive C:\Users\Administrator\Desktop\自动化测试相关资源\百度.apk: I/O error
ERROR: dump failed because no AndroidManifest.xml found

63131e211bf545f0a9aab594c20f0412.png

2、原因分析及解决办法

就是路径中包含了中文,在开发的过程中,无论在什么环境中,都建议不要出现中文,编码集这个东西不靠谱,指不定什么时候就给你来一下。

使用的新路径:aapt.exe dump badging E:\baidu.apk

分析结果如下:

edb696ca4481402687a468e5e45e112d.png

 

Get:320 http://ports.ubuntu.com/ubuntu-ports bionic-security/multiverse arm64 DEP-11 Metadata [208 B] Get:279 http://ports.ubuntu.com/ubuntu-ports bionic-updates/restricted arm64 DEP-11 Metadata [212 B] Fetched 5,077 kB in 2min 14s (37.8 kB/s) Reading package lists... Done E: Failed to fetch http://mirrors.aliyun.com/ubuntu/dists/bionic/main/binary-arm64/Packages 404 Not Found [IP: 222.192.186.76 80] E: Failed to fetch http://mirrors.aliyun.com/ubuntu/dists/bionic-security/main/binary-arm64/Packages 404 Not Found [IP: 222.192.186.76 80] E: Failed to fetch http://mirrors.aliyun.com/ubuntu/dists/bionic-updates/main/binary-arm64/Packages 404 Not Found [IP: 222.192.186.76 80] E: Failed to fetch http://mirrors.aliyun.com/ubuntu/dists/bionic-proposed/main/binary-arm64/Packages 404 Not Found [IP: 222.192.186.76 80] E: Failed to fetch https://mirrors.ustc.edu.cn/ubuntu/dists/bionic/main/binary-arm64/Packages 404 Not Found [IP: 202.38.95.110 443] E: Failed to fetch https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/bionic/main/binary-arm64/Packages 404 Not Found [IP: 101.6.15.130 443] E: Failed to fetch https://mirrors.ustc.edu.cn/ubuntu/dists/bionic-security/main/binary-arm64/Packages 404 Not Found [IP: 202.38.95.110 443] E: Failed to fetch https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/bionic-updates/main/binary-arm64/Packages 404 Not Found [IP: 101.6.15.130 443] E: Failed to fetch https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/bionic-backports/main/binary-arm64/Packages 404 Not Found [IP: 101.6.15.130 443] E: Failed to fetch https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/bionic-security/main/binary-arm64/Packages 404 Not Found [IP: 101.6.15.130 443] E: Failed to fetch https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/bionic-proposed/main/binary-arm64/Packages 404 Not Found [IP: 101.6.15.130 443] E: Failed to fetch https://mirrors.ustc.edu.cn/ubuntu/dists/bionic-updates/main/binary-arm64/Packages 404 Not Found [IP: 202.38.95.110 443] E: Failed to fetch https://mirrors.ustc.edu.cn/ubuntu/dists/bionic-backports/main/binary-arm64/Packages 404 Not Found [IP: 202.38.95.110 443] E: Some index files failed to download. They have been ignored, or old ones used instead.
最新发布
03-13
<think>好的,我现在需要帮助用户解决他们在运行apt update时遇到的404错误。用户之前的问题是关于nano未安装,现在他们遇到了软件源的问题。首先,我需要理解错误信息中的关键点。错误显示多个仓库的URL返回404,特别是针对arm64架构的包。这些URL包括阿里云、中科大和清华的镜像源。 首先,我应该考虑这些镜像源是否支持arm64架构。Ubuntu的不同镜像源可能对架构的支持不同,有些可能没有为arm64提供完整的软件包。比如,用户使用的是Ubuntu 18.04(bionic),而某些镜像源可能在bionic的仓库中没有arm64的二进制包,或者路径不同。 接下来,用户可能在软件源列表(sources.list)中配置了多个镜像源,导致系统尝试从多个地方获取arm64的包,但有些镜像源不支持,因此返回404。例如,阿里云的镜像可能没有为bionic的arm64提供main仓库的包,或者路径结构不同。同样的问题可能出现在其他镜像源上。 解决方案的第一步应该是检查当前的软件源配置。用户可能需要将软件源切换到官方端口仓库(ports.ubuntu.com),因为官方仓库通常会支持所有架构,包括arm64。此外,用户可能错误地使用了针对amd64的镜像源,而没有使用专门为arm64配置的源。 另一个可能性是Ubuntu 18.04(bionic)的某些仓库已经归档,转移到了old-releases仓库。如果用户使用的镜像源没有正确指向旧版仓库,也会导致404错误。不过,根据错误信息中的URL,用户似乎还在使用常规的仓库路径,而不是old-releases,所以这可能不是主要原因。 接下来,我需要建议用户修改他们的sources.list文件,替换镜像源为支持arm64的官方端口或确认可用的镜像。例如,将http://ports.ubuntu.com/ubuntu-ports作为主源,或者使用已知支持arm64的国内镜像,如清华源的ubuntu-ports部分。 另外,用户可能需要检查每个软件源行是否正确指定了[arch=arm64],或者是否遗漏了特定的组件(如main、universe等)。此外,确保发行版名称(bionic)和仓库类别(updates, security等)正确无误。 在指导用户修改sources.list时,需要提醒他们备份原文件,避免出错。然后,提供具体的sed命令或手动编辑的步骤,替换镜像源为正确的地址。之后,运行apt update来测试是否解决了问题。 如果问题仍然存在,可能需要进一步检查网络连接,或者尝试不同的镜像源。例如,推荐使用清华源或中科大的arm64专用镜像,并确保URL路径正确。 最后,如果用户的问题是因为Ubuntu版本较旧(如18.04已过支持周期),建议升级到较新的LTS版本,如20.04或22.04,以获得更好的支持和更新的软件包。</think>### **错误原因分析** 出现`404 Not Found`错误的主要原因是**软件源配置中的镜像地址不支持arm64架构**或**镜像站未维护旧版Ubuntu仓库**。您当前系统是Ubuntu 18.04(代号`bionic`),且为ARM64架构,但配置的镜像源(阿里云、清华、中科大等)可能: 1. 未提供`bionic`版本的arm64软件包 2. 未正确同步`ubuntu-ports`仓库(ARM架构专用仓库) 3. 镜像站已停止维护旧版Ubuntu资源 --- ### **解决方案** #### **步骤1:切换至官方ARM专用仓库** ```bash # 备份原配置文件 sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak # 使用sed命令替换镜像源为官方ports仓库 sudo sed -i 's|http://[^/]*/ubuntu|http://ports.ubuntu.com/ubuntu-ports|g' /etc/apt/sources.list sudo sed -i 's|https://[^/]*/ubuntu|http://ports.ubuntu.com/ubuntu-ports|g' /etc/apt/sources.list # 更新软件源 sudo apt update ``` #### **步骤2:使用国内ARM兼容镜像源(如清华源)** 若需国内加速,需**明确使用支持`ubuntu-ports`的镜像**: ```bash # 编辑sources.list sudo nano /etc/apt/sources.list # 替换所有内容为以下配置(清华源ARM64专用) deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main restricted universe multiverse deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main restricted universe multiverse deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main restricted universe multiverse deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main restricted universe multiverse ``` #### **步骤3:清理缓存并重试** ```bash # 清除旧索引 sudo rm -rf /var/lib/apt/lists/* # 重新生成缓存 sudo apt update ``` --- ### **关键配置验证** 检查`sources.list`需满足以下格式: ``` deb http://[支持arm64的镜像地址]/ubuntu-ports bionic-[类别] main restricted universe multiverse ``` - ✅ 正确地址:`http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports` - ❌ 错误地址:`http://mirrors.aliyun.com/ubuntu`(缺少`-ports`路径) --- ### **操作效果对比** | 操作前错误特征 | 修复后成功标志 | |------------------------------|---------------------------------| | `.../bionic/main/binary-arm64/Packages 404` | `Hit:1 http://ports.ubuntu.com bionic InRelease` | | 多镜像源交替报错 | 统一从`ubuntu-ports`仓库下载 | --- ### **扩展建议** 1. **升级Ubuntu版本** Ubuntu 18.04(bionic)已于2023年4月停止官方支持,建议升级至20.04/22.04: ```bash sudo do-release-upgrade ``` 2. **检查仓库架构支持** 访问镜像站目录验证路径是否存在(以清华源为例): [http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/dists/bionic/main/binary-arm64/](http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/dists/bionic/main/binary-arm64/) --- ### **常见问题处理** | 现象 | 解决方案 | |-------------------------------|----------------------------| | 替换镜像源后仍报404 | 检查是否遗漏`-ports`路径 | | 无法连接官方仓库 | 使用`curl -I http://ports.ubuntu.com`测试网络连通性 | | 依赖包缺失 | 添加`universe`和`multiverse`仓库 | 如果需要进一步调试,可执行以下命令检查仓库配置: ```bash apt-config dump | grep -i "uri" # 查看当前生效的仓库地址 ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

雾林小妖

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值