[WSL]安装Android Studio

幻想 2022年09月25日 25 0

背景

由于Win系统的不稳定,而且java等编译速度没有linux的快,所以想将AS转移到Linux,但又不想换系统,而现在的wslg已经相对稳定,因此有了此文。

步骤

  1. 这边使用的是almalinux9的系统,然后执行以下指令
# 换为国内阿里源
sed -e 's|^mirrorlist=|#mirrorlist=|g'  -e 's|^# baseurl=https://repo.almalinux.org|baseurl=https://mirrors.aliyun.com|g' -i.bak /etc/yum.repos.d/almalinux*.repo
# 生成缓存
dnf makecache
# 安装jdk(jdk自带图形依赖)等
dnf install epel-release dnf-plugins-core java-17-openjdk which
# 升级软件
dnf update
  1. 从官网下载AS包(地址,记得选linux版本)
  2. 解压安装包
# 这边下载的包名是:android-studio-2021.3.1.16-linux.tar.gz
tar -zxvf android-studio-2021.3.1.16-linux.tar.gz -C /opt/
# 删除压缩包
rm -f android-studio-2021.3.1.16-linux.tar.gz
  1. 在win终端运行
# 安装完AS后,想让图形界面生效,需要重启wsl
wsl --shutdown
# 然后这样即可运行AS,以下AndroidStudio是我给安装的wsl命名的发行名称
wslg -d AndroidStudio "/opt/android-studio/bin/studio.sh"
  1. 这时已经算是已经安装完AS了,不过为了方便,也可以创建快捷方式,方便直接运行
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=Android Studio
Exec=/opt/android-studio/bin/studio.sh
Icon=/opt/android-studio/bin/studio.png
Terminal=false
Categories=Application;

以上就可以开始对AS进行玩耍了。

Last Updated: 2022/09/30 04:43:59
[WSL]安装jetbrains idea [Android Studio]Task list not built during sync