学习Android framework第一天

132 阅读1分钟

最近入职了某公司搞车载开发,干了一个月了,想提升提升自己,先下个最新的AOSP玩玩,使用windwos11 自带的WSL2,具体怎么搞可以找找度娘,先把WSL2的一些配置搞好,去C:\Users\xxx目录下创建一个.wslconfig文件,输入以下内容:

[wsl2]
memory=24GB
swap=16GB

[experimental]
autoMemoryReclaim=gradual
networkingMode=mirrored
dnsTunneling=true
firewall=true
autoProxy=true

具体啥意思自行百度,然后打开cmd输入wsl,再输入以下命令

cd ~
mkdir bin
cd bin

sudo apt update

sudo apt-get install git-core gnupg flex bison build-essential zip curl zlib1g-dev libc6-dev-i386 libncurses5 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig

apt install repo

repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest 

cd .repo/manifests

git pull

# 看看有哪些分支,找到最新的分支,15.0.0_r8
git branch -a 

# 使用最新的
cd ~/bin
repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b android-15.0.0_r8

# 同步分支,这个16 是你使用的工作线程数量
repo sync -c -j16

# 拉下来后,使用
source build/envsetup.sh 
lunch sdk_phone64_x86_64-trunk_staging-eng
# 开始构建  16工作线程
m -j16

# 构建完后,启动虚拟机
emulator

感觉分辨率不舒服可以去out/target/product/emu64x/config.ini进行修改

hw.lcd.density=240  屏幕密度
hw.cpu.ncore = 4
hw.mainKeys=no
hw.ramSize = 4096 
hw.sensors.orientation=yes 
hw.sensors.proximity=yes
image.sysdir.1=x86/
skin.dynamic=no 
skin.name=480x800   分辨率
skin.path=480x800

出现启动界面就大功告成咯

851dd2509894613f247cf3fdd3b0675.png