Android Studio for Platform (ASfP) 使用教程

文章目录


归纳的很清楚,下载Repo并下载源码->可以参考我的 Framework入门のPiex 6P源码(下载/编译/刷机)

启动图标(重启生效)

shell 复制代码
[Desktop Entry]
Encoding=UTF-8
Name=AndroidStudio                                     
Comment=AndroidStudio                                  
Exec=/opt/android-studio-for-platform/bin/studio.sh
Icon=/opt/android-studio-for-platform/bin/studio.png
Terminal=false
StartupNotify=true
Type=Application
Categories=Application;Development;

OR
/opt/android-studio-for-platform/bin/studio.sh

编写脚本

bash 复制代码
#!/usr/bin/env bash
 
export LOG_ACCOUNT=tmp
export LOG_FILENAME=repo-sync
export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo'
 
aosp_branch=android-11.0.0_r9
 
if [ ! -d ".repo" ]; then
    repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b $aosp_branch
    repo_stat=$?
    if [ $repo_stat -ne 0 ]; then
        echo "init repo faild, please try again"
        exit 0
    fi
else
    log -o -- "local .repo dir exists"
fi
 
try_count=0
echo "from remote sync aosp"
 
repo sync
repo_stat=$?
while [ $repo_stat -ne 0 ]; do
    log -o -- "sync faild, status: $repo_stat, try again in 5s ..."
    sleep 5
    repo sync
    repo_stat=$?
    ((try_count++))
done
 
echo "sync repo over, try_count: $try_count"
echo "sync over, success"

下载源代码

lunch 查看版本

bash 复制代码
Lunch menu... pick a combo:
     1. aosp_arm-eng
     2. aosp_arm64-eng
     3. aosp_blueline-userdebug
     4. aosp_blueline_car-userdebug
     5. aosp_bonito-userdebug
     6. aosp_bonito_car-userdebug
     7. aosp_bramble-userdebug
     8. aosp_car_arm-userdebug
     9. aosp_car_arm64-userdebug
     10. aosp_car_x86-userdebug
     11. aosp_car_x86_64-userdebug
     12. aosp_cf_arm64_auto-userdebug
     13. aosp_cf_arm64_phone-userdebug
     14. aosp_cf_x86_64_phone-userdebug
     15. aosp_cf_x86_auto-userdebug
     16. aosp_cf_x86_phone-userdebug
     17. aosp_cf_x86_tv-userdebug
     18. aosp_coral-userdebug
     19. aosp_coral_car-userdebug
     20. aosp_crosshatch-userdebug
     21. aosp_crosshatch_car-userdebug
     22. aosp_flame-userdebug
     23. aosp_flame_car-userdebug
     24. aosp_redfin-userdebug
     25. aosp_sargo-userdebug
     26. aosp_sunfish-userdebug
     27. aosp_taimen-userdebug
     28. aosp_trout_arm64-userdebug
     29. aosp_trout_x86-userdebug
     30. aosp_walleye-userdebug
     31. aosp_walleye_test-userdebug
     32. aosp_x86-eng
     33. aosp_x86_64-eng
     34. arm_krait-eng
     35. arm_v7_v8-eng
     36. armv8-eng
     37. armv8_kryo385-eng
     38. beagle_x15-userdebug
     39. beagle_x15_auto-userdebug
     40. car_x86_64-userdebug
     41. db845c-userdebug
     42. fuchsia_arm64-eng
     43. fuchsia_x86_64-eng
     44. hikey-userdebug
     45. hikey64_only-userdebug
     46. hikey960-userdebug
     47. hikey960_tv-userdebug
     48. hikey_tv-userdebug
     49. pixel3_mainline-userdebug
     50. poplar-eng
     51. poplar-user
     52. poplar-userdebug
     53. qemu_trusty_arm64-userdebug
     54. silvermont-eng
     55. uml-userdebug
     56. yukawa-userdebug
     57. yukawa_sei510-userdebug

lunch product_name-build_variant
product_name 作为需要构建的产品
build_variant 作为需要构建的变体
PS:安卓官网这步给出的 lunch aosp_arm-eng在实际编译完成后是无法正常运行的,这个是很大的,很多人都是在这一步卡住了很久

真正能在模拟器上运行的是 lunch sdk_phone_x86_64


开始编译

shell 复制代码
Syncing targets: [frameworks, packages/apps/Settings]

Preparing for sync...
Updating MAX_ARG_STRLEN to 131072

Generating Soong artifacts...
/bin/bash -c "source build/envsetup.sh && lunch sdk_phone_x86_64 && echo ANDROID_PRODUCT_OUT=$ANDROID_PRODUCT_OUT && refreshmod"

Refreshing modules (building module-info.json). Log at /data/android-11.0.0_r9/out/target/product/generic_x86_64/module-info.json.build.log.
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=11
TARGET_PRODUCT=sdk_phone_x86_64
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_ARCH=x86_64
TARGET_ARCH_VARIANT=x86_64
TARGET_2ND_ARCH=x86
TARGET_2ND_ARCH_VARIANT=x86_64
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-5.15.0-86-generic-x86_64-Ubuntu-20.04.4-LTS
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=RD1A.200810.020.A1
OUT_DIR=out
PRODUCT_SOONG_NAMESPACES=device/generic/goldfish device/generic/goldfish-opengl hardware/google/camera hardware/google/camera/devices/EmulatedCamera device/generic/goldfish device/generic/goldfish-opengl
============================================
ANDROID_PRODUCT_OUT=/data/android-11.0.0_r9/out/target/product/generic_x86_64

编译成功

IDE占用内存高达8G

虚拟机设置

https://developer.android.com/studio/platform?hl=zh-cn

https://adtxl.com/index.php/archives/85.html

https://blog.csdn.net/u011897062/article/details/133065217

相关推荐
赏金术士3 小时前
Compose 教学项目
android·kotlin·compose
晓梦林3 小时前
ximai靶场学习笔记
android·笔记·学习
十六年开源服务商8 小时前
2026服务器配置优化与WordPress运维实战指南
android·运维·服务器
音视频牛哥9 小时前
大牛直播SDK(SmartMediaKit)Android平台Unity3D RTSP/RTMP播放器集成实践
android·unity3d·rtsp播放器·rtmp播放器·unity3d rtmp播放器·安卓unity rtsp播放器·安卓unity rtmp播放器
w1wi9 小时前
安卓抓包完全指南(一):从入门到 SSL Pinning 绕过
android·网络协议·ssl
aqi0011 小时前
一文理清 HarmonyOS 6.0.2 涵盖的十个升级点
android·华为·harmonyos·鸿蒙·harmony
赏金术士12 小时前
Jetpack Compose 状态提升(State Hoisting)完全指南
android·kotlin·compose
BoomHe13 小时前
git Rebase 为任意一笔提交补上 Change-Id
android·git·android studio
TDengine (老段)13 小时前
TDengine 超级表/子表/普通表 — 设计理念与内部表示
android·大数据·数据库·物联网·时序数据库·tdengine·涛思数据