Linux 跑安卓

Waydroid#

安装#

sudo apt install curl ca-certificates
curl https://repo.waydro.id | sudo bash
sudo apt install waydroid

配置#

sudo http_proxy="http://127.0.0.1:7890" https_proxy="http://127.0.0.1:7890" waydroid init
sudo systemctl stop waydroid-container
sudo /usr/bin/python3 /usr/bin/waydroid -w container start
sudo systemctl start waydroid-container
sudo systemctl status waydroid-container

ARM兼容层#

git clone https://github.com/casualsnek/waydroid_script
cd waydroid_script
python -m pip install -r requirements.txt # 建议用虚拟环境哈~
python main.py  install libhoudini

配置页面#

https://docs.waydro.id/usage/waydroid-prop-options

解决app检测网络问题#

包名通配

waydroid prop set persist.waydroid.fake_wifi "com.netease.*"
sudo ufw allow 53
sudo ufw allow 67
sudo ufw default allow FORWARD

挂载文件#

sudo mount --bind ~/Downloads ~/.local/share/waydroid/data/media/0/Download

adb#

adb connect <IP>:5555

安卓玩机

shizuku#

启动命令:

adb shell sh /storage/emulated/0/Android/data/moe.shizuku.privileged.api/start.sh

自动任务 AutoTask#

自动化任务

Scene#

查看安卓进程管理

App Ops#

App权限监测

ADB#

设置http代理#

adb shell settings put global http_proxy 192.168.105.230:8080
adb shell settings put global https_proxy 192.168.105.230:8080
# 删除代理
adb shell settings delete global http_proxy 
Deleted 1 rows
adb shell settings delete global https_proxy 
Deleted 1 rows
adb shell settings delete global global_http_proxy_host
Deleted 1 rows
adb shell settings delete global global_https_proxy_host
Deleted 0 rows
adb shell settings delete global global_http_proxy_port
Deleted 1 rows
adb shell settings delete global global_https_proxy_port
Deleted 0 rows

# 需要冲起生效 - 有的机器可能不用
adb reboot

小小电脑#

1. 配置ssh#

apt install openssh-server

vim /etc/ssh/sshd_config
# 改配置端口>=1024, 一般用8022
mkdir /run/sshd
sudo /sbin/sshd

# 或者图方便
sudo /sbin/sshd -p 8022

2. 配置自动补全#

sudo apt install bash-completion
echo '[[ -r /etc/bash_completion ]] && . /etc/bash_completion' >> ~/.bashrc && source ~/.bashrc
# ~/.bashrc 中补充
# -> [[ -r /etc/bash_completion ]] && . /etc/bash_completion

安卓

将安卓手机用于开发#

Termux#

类似于WIN端的Subsystem——其实更像Ubuntu下的虚拟终端。 不过这东西功能强大,除了将安卓里的Linux发挥出来。还有Termux API来调用手机的底层接口。

XFCE4#

步骤

  1. 安装Termux
  2. 执行pkg update
  3. 执行pkg install git && git clone https://github.com/Yisus7u7/termux-desktop-xfce.git
  4. 执行cd termux-desktop-xfce && bash boostrap.sh

当然,3&4步可以合并为一句curl -sLf https://raw.githubusercontent.com/Yisus7u7/termux-desktop-xfce/main/boostrap.sh | bash

VNC#

默认VNC只能通过localhost:1来连接,局域网不能访问。想用大屏来看就不是很方便。

# 先执行`vncserver`使用本机的`VNC Viewer`看看效果,主要是需要先设置一下密码
vncserver
# 现在还无法通过局域网连接
# 去设置
cd ~/.vnc/
vim config # 打开最后一行注释
# 重新运行
vncserver -kill :1
vncserver

配置文件一览#

config文件最后一行的注释打开,即可

## Supported server options to pass to vncserver upon invocation can be listed
## in this file. See the following manpages for more: vncserver(1) Xvnc(1).
## Several common ones are shown below. Uncomment and modify to your liking.
##
# securitytypes=vncauth,tlsvnc
# desktop=sandbox
geometry=1280x720
# localhost
# alwaysshared 将这行注释取消注释
alwaysshared # 修改成这样

现在各个版本概览#

  • python - 3.10
  • clang - 14.0.5
  • opencv - 4.5.5

NumPy#

# pip3 install numpy 不能安装
MATHLIB="m" pip3 install numpy
# numpy      1.22.4

C++ & OpenCV#

现在安装opencv-python还有问题,可能问题出现在安装numpy上,但后来经过努力安装好了,但版本或者其他问题导致还是不能正常运行.但C++还是很好呀.