惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
Cybersecurity and Infrastructure Security Agency CISA
N
News and Events Feed by Topic
S
Securelist
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Spread Privacy
Spread Privacy
T
Threat Research - Cisco Blogs
T
Tor Project blog
C
Cyber Attacks, Cyber Crime and Cyber Security
K
Kaspersky official blog
L
LINUX DO - 热门话题
T
The Exploit Database - CXSecurity.com
S
Schneier on Security
A
Arctic Wolf
Security Latest
Security Latest
T
Threatpost
P
Palo Alto Networks Blog
Simon Willison's Weblog
Simon Willison's Weblog
AWS News Blog
AWS News Blog
Cyberwarzone
Cyberwarzone
L
Lohrmann on Cybersecurity
P
Privacy International News Feed
V
Vulnerabilities – Threatpost
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Cisco Talos Blog
Cisco Talos Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
G
GRAHAM CLULEY
The Hacker News
The Hacker News
C
CERT Recently Published Vulnerability Notes
Know Your Adversary
Know Your Adversary
I
Intezer
Scott Helme
Scott Helme
T
Tenable Blog
NISL@THU
NISL@THU
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Cisco Blogs
N
News and Events Feed by Topic
P
Proofpoint News Feed
P
Privacy & Cybersecurity Law Blog
Project Zero
Project Zero
Latest news
Latest news
Hacker News: Ask HN
Hacker News: Ask HN
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Forbes - Security
Forbes - Security
Security Archives - TechRepublic
Security Archives - TechRepublic
AI
AI
S
Security Affairs
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
D
Docker
P
Proofpoint News Feed
博客园 - Franky

技术小黑屋

Vibe Coding 的安全风险与应对策略 - 技术小黑屋 Vibe Coding 最佳实践:10 个让开发效率提升 10 倍的关键技巧 一看就会,为 AI 编程 Agent 撸一个 MCP 服务 同样是 Sonnet 4.5,为何 CLI 工具差距这么大 定位 Android 权限声明来源 - 技术小黑屋 Android 升级 targetSDK 35 解决 namespace 问题 解决 Android Studio 关闭后终端 flutter run 进程自动结束的问题 使用 grep 查找关键字并显示上下文行 - 技术小黑屋 Android 开发中的三个常见构建错误及解决方案 - 技术小黑屋 使用 flock 解决 Git `unable to read tree` 问题 幂等性的劣化:从数学确定性到 AI 不确定性 - 技术小黑屋 Could not create task ':generateDebugRFile' 问题小记 Vs Code 快速实现 重写 方法 Merge(Pull) Request 推荐的标签列表 - 技术小黑屋 中国特惠!多平台广告屏蔽专家 AdGuard 买断仅需 119 元起 使用 FVM 解决 flutter 3 无法添加 uploader 问题 AAPT2 aapt2-7.2.2-7984345-osx Daemon #5: Idle daemon unexpectedly exit. This should not happen 问题解决 git clone 使用代理,实现百倍加速 - 技术小黑屋 Flutter 处理 Error Setter not found AsciiChar 问题
Android 模拟器实现 hosts 修改 - 技术小黑屋
androidyue · 2023-03-12 · via 技术小黑屋

有时候我们需要使用 Android 模拟器来 绑定一下 hosts 来实现功能的开发与验证,刚好最近遇到了这样的需求,处理完成,简单记录一下。

替换m1 实现(针对 苹果 M1 芯片才需要处理)

下载这个文件 https://github.com/google/android-emulator-m1-preview/releases/download/0.2/emulator-darwin-aarch64-0.2-engine-only.zip

解压,然后将 emulatoremulator-check 替换掉这里面的文件 ~/Library/Android/sdk/tools/ (原有的可以备份为 xxx_backup)

查看 avd_id

1
2
3
4
5
6
7
~/Library/Android/sdk/tools/emulator -list-avds
Pixel6ProAPI33
Pixel_3a_API_33_arm64-v8a
Pixel_6_API_22
Pixel_6_API_28
Pixel_6_Pro_API_23
Pixel_6_Pro_API_30_X86

启动 avd,可写入状态

1
~/Library/Android/sdk/tools/emulator -avd Pixel_3a_API_33_arm64-v8a  -writable-system

新起终端tab 执行

  1. adb root
  2. adb remount
  3. adb push your_hosts_on_mac /etc/hosts

验证ping

假设上面的 hosts 我们新增了 127.0.0.1 baidu.com

1
2
3
4
5
6
adb shell

ping baidu.com
PING baidu.com (127.0.0.1) 56(84) bytes of data.
64 bytes from baidu.com (127.0.0.1): icmp_seq=1 ttl=64 time=1.55 ms
64 bytes from baidu.com (127.0.0.1): icmp_seq=2 ttl=64 time=0.180 ms

注意: hosts 修改建议在 mac 上进行处理,然后使用adb push your_hosts_on_mac /etc/hosts 替换手机内的hosts。手机内置的 vi 很弱,可能无法编辑。

以上。