Android Studio for Platform (ASfP) 使用教程

2023-12-24 04:10

本文主要是介绍Android Studio for Platform (ASfP) 使用教程,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

文章目录

      • 编写Repo脚本
      • 下载源代码
      • lunch 查看版本

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

启动图标(重启生效)

[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

修改vmoptions配置
/opt/android-studio-for-platform/bin/studio64.vmoptions
网上搜索了下相关配置主要是对 Xmx 的修改

heap size
-Xms-Xmx 配置堆内存,也就是 IntelliJ 可以使用的内存。-Xms 初始堆内存,调大该内存可以让启动速度更快,以省去分配内存的时间
-Xmx 最大堆内存,如果遇到 OutOfMemoryError 可以调大该数值,最大不要超过系统 1/4.
GC Algorithm
-XX:+UseConcMarkSweepGC 参数用来调整 GC 算法。使用该算法利用多个线程在后台进行 GC,以避免应用程序停止。当分配超过 4GB 的堆内存时,可以尝试使用 -XX:+UseG1GC.Other
-ea 选项开启 assertions。如果调试 IntelliJ 或者开发插件时可能用到,对 IntelliJ 性能并没有影响。-server 虚拟机的解释执行模式。-XX:SoftRefLRUPolicyMSPerMB=[value] 参数用来控制每 M 空间中 soft reference 保证存活的毫秒数。默认的时间是 1000JetBrains 推荐 50-XX:ReservedCodeCacheSize=510m 设置编译器最大的 code cache,另外一个相关的 JVM 参数是 -XX:InitialCodeCacheSize JetBrains 推荐这里使用 240m. 1-Dsun.io.useCanonCaches=[boolean] 该参数是否开启文件名及路径缓存,默认 java 会缓存文件名 302JetBrains 建议关闭。-XX:+OmitStackTraceInFastThrow JetBrains 官方推荐的参数。-XX:MaxJavaStackTraceDepth=-1 JVM 在实现 java.lang.Throwable.fillInStackTrace() 时把整个调用栈上的所有 Java 栈帧消息记录下来-XX:+HeapDumpOnOutOfMemoryError 当发生 OutOfMemoryError 时 dump 堆内容。3

编写Repo脚本

#!/usr/bin/env bashexport 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_r9if [ ! -d ".repo" ]; thenrepo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b $aosp_branchrepo_stat=$?if [ $repo_stat -ne 0 ]; thenecho "init repo faild, please try again"exit 0fi
elselog -o -- "local .repo dir exists"
fitry_count=0
echo "from remote sync aosp"repo sync
repo_stat=$?
while [ $repo_stat -ne 0 ]; dolog -o -- "sync faild, status: $repo_stat, try again in 5s ..."sleep 5repo syncrepo_stat=$?((try_count++))
doneecho "sync repo over, try_count: $try_count"
echo "sync over, success"

下载源代码

在这里插入图片描述

lunch 查看版本

Lunch menu... pick a combo:1. aosp_arm-eng2. aosp_arm64-eng3. aosp_blueline-userdebug4. aosp_blueline_car-userdebug5. aosp_bonito-userdebug6. aosp_bonito_car-userdebug7. aosp_bramble-userdebug8. aosp_car_arm-userdebug9. aosp_car_arm64-userdebug10. aosp_car_x86-userdebug11. aosp_car_x86_64-userdebug12. aosp_cf_arm64_auto-userdebug13. aosp_cf_arm64_phone-userdebug14. aosp_cf_x86_64_phone-userdebug15. aosp_cf_x86_auto-userdebug16. aosp_cf_x86_phone-userdebug17. aosp_cf_x86_tv-userdebug18. aosp_coral-userdebug19. aosp_coral_car-userdebug20. aosp_crosshatch-userdebug21. aosp_crosshatch_car-userdebug22. aosp_flame-userdebug23. aosp_flame_car-userdebug24. aosp_redfin-userdebug25. aosp_sargo-userdebug26. aosp_sunfish-userdebug27. aosp_taimen-userdebug28. aosp_trout_arm64-userdebug29. aosp_trout_x86-userdebug30. aosp_walleye-userdebug31. aosp_walleye_test-userdebug32. aosp_x86-eng33. aosp_x86_64-eng34. arm_krait-eng35. arm_v7_v8-eng36. armv8-eng37. armv8_kryo385-eng38. beagle_x15-userdebug39. beagle_x15_auto-userdebug40. car_x86_64-userdebug41. db845c-userdebug42. fuchsia_arm64-eng43. fuchsia_x86_64-eng44. hikey-userdebug45. hikey64_only-userdebug46. hikey960-userdebug47. hikey960_tv-userdebug48. hikey_tv-userdebug49. pixel3_mainline-userdebug50. poplar-eng51. poplar-user52. poplar-userdebug53. qemu_trusty_arm64-userdebug54. silvermont-eng55. uml-userdebug56. yukawa-userdebug57. yukawa_sei510-userdebug

lunch product_name-build_variant
product_name作为需要构建的产品
build_variant 作为需要构建的变体

PS:安卓官网这步给出的 lunch aosp_arm-eng在实际编译完成后是无法正常运行的,这个是很大的,很多人都是在这一步卡住了很久
真正能在模拟器上运行的是 lunch sdk_phone_x86_64
在这里插入图片描述
在这里插入图片描述
开始编译

Syncing targets: [frameworks, packages/apps/Settings]Preparing for sync...
Updating MAX_ARG_STRLEN to 131072Generating 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

这篇关于Android Studio for Platform (ASfP) 使用教程的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/530503

相关文章

使用Navicat工具比对两个数据库所有表结构的差异案例详解

《使用Navicat工具比对两个数据库所有表结构的差异案例详解》:本文主要介绍如何使用Navicat工具对比两个数据库test_old和test_new,并生成相应的DDLSQL语句,以便将te... 目录概要案例一、如图两个数据库test_old和test_new进行比较:二、开始比较总结概要公司存在多

MySQL8.2.0安装教程分享

《MySQL8.2.0安装教程分享》这篇文章详细介绍了如何在Windows系统上安装MySQL数据库软件,包括下载、安装、配置和设置环境变量的步骤... 目录mysql的安装图文1.python访问网址2javascript.点击3.进入Downloads向下滑动4.选择Community Server5.

CSS3中使用flex和grid实现等高元素布局的示例代码

《CSS3中使用flex和grid实现等高元素布局的示例代码》:本文主要介绍了使用CSS3中的Flexbox和Grid布局实现等高元素布局的方法,通过简单的两列实现、每行放置3列以及全部代码的展示,展示了这两种布局方式的实现细节和效果,详细内容请阅读本文,希望能对你有所帮助... 过往的实现方法是使用浮动加

如何使用Spring boot的@Transactional进行事务管理

《如何使用Springboot的@Transactional进行事务管理》这篇文章介绍了SpringBoot中使用@Transactional注解进行声明式事务管理的详细信息,包括基本用法、核心配置... 目录一、前置条件二、基本用法1. 在方法上添加注解2. 在类上添加注解三、核心配置参数1. 传播行为(

在Java中使用ModelMapper简化Shapefile属性转JavaBean实战过程

《在Java中使用ModelMapper简化Shapefile属性转JavaBean实战过程》本文介绍了在Java中使用ModelMapper库简化Shapefile属性转JavaBean的过程,对比... 目录前言一、原始的处理办法1、使用Set方法来转换2、使用构造方法转换二、基于ModelMapper

c++中std::placeholders的使用方法

《c++中std::placeholders的使用方法》std::placeholders是C++标准库中的一个工具,用于在函数对象绑定时创建占位符,本文就来详细的介绍一下,具有一定的参考价值,感兴... 目录1. 基本概念2. 使用场景3. 示例示例 1:部分参数绑定示例 2:参数重排序4. 注意事项5.

使用C++将处理后的信号保存为PNG和TIFF格式

《使用C++将处理后的信号保存为PNG和TIFF格式》在信号处理领域,我们常常需要将处理结果以图像的形式保存下来,方便后续分析和展示,C++提供了多种库来处理图像数据,本文将介绍如何使用stb_ima... 目录1. PNG格式保存使用stb_imagephp_write库1.1 安装和包含库1.2 代码解

一文教你使用Python实现本地分页

《一文教你使用Python实现本地分页》这篇文章主要为大家详细介绍了Python如何实现本地分页的算法,主要针对二级数据结构,文中的示例代码简洁易懂,有需要的小伙伴可以了解下... 在项目开发的过程中,遇到分页的第一页就展示大量的数据,导致前端列表加载展示的速度慢,所以需要在本地加入分页处理,把所有数据先放

CentOS系统Maven安装教程分享

《CentOS系统Maven安装教程分享》本文介绍了如何在CentOS系统中安装Maven,并提供了一个简单的实际应用案例,安装Maven需要先安装Java和设置环境变量,Maven可以自动管理项目的... 目录准备工作下载并安装Maven常见问题及解决方法实际应用案例总结Maven是一个流行的项目管理工具

Spring Boot Actuator使用说明

《SpringBootActuator使用说明》SpringBootActuator是一个用于监控和管理SpringBoot应用程序的强大工具,通过引入依赖并配置,可以启用默认的监控接口,... 目录项目里引入下面这个依赖使用场景总结说明:本文介绍Spring Boot Actuator的使用,关于Spri