Installing Android Studio 2021.2 in Linux
The download is here. For Linux it is a tarball.
I want to put it in
/opt. Outdated installation instructions at android.com confirm this a valid solution. Extracting directly to
/opt via Nautilus/Archive-Manager, presented a permission denied error. I had to first extract to
~ and then move the directory across.
I moved the directory via Nautilus, and it was at least as slow as copying. Not the typically instant move operation I was expecting. I was prompted for my password no less than 3 times! All whilst reading the local rag in my browser (and having to wonder what ad-ware this might be). I recommend trying
sudo mv ~/android-studio /opt/ next time. All the folders were owned by
root. All the files were owned by me. Judging by the sister folders in
/opt, this appears normal. Unusually for a tarball, all the files are dated 1st Jan 2010.
I couldn't simply double-click
/opt/android-studio/bin/studio.sh. Doing so earned me a password prompt, and a gedit view of the script. I should know by now, use the shell:
The first window soon appeared asking do I want a typical or customised installation? Android Studio on Linux, of course I want to customise! I chose the most minimal options which included the SDK and latest Android API (33). This came to another 800MB and went much more smoothly than the move to
/opt. Nearly a 2GB investment, which is a lot of inertia to just view my old projects before I update to 22.04.1.
Many installation guides recommend installing different, and confusing, versions of the JDK/JRE. As an avid Java Developer I was itching to get cracking and install a suitably open and modern, openjdk-11-jdk. I refrained, deferring to Android Studio to decide its dependencies.
During installation the only Java I was questioned about was what JRE I would let gradle use. I accepted the default provided for me at
/opt/android-studio/jre/bin/. That leaves me free from needing to uninstall a chain of tooling should I learn more about the current Java needs of Android and Android Studio.
That's it. I can close this window and restart from my desktop. Everything is working.
I created a new project, only to let Android choose the default location. I accepted the defaults, of Lollipop 5.0 as a baseline, and Kotlin. For activity type I chose "No activity". Apparently this required another 63MB of downloading, in the form of Android SDK Platform 32:
Packages to install: - Android SDK Platform 32 (platforms;android-32) Preparing "Install Android SDK Platform 32 (revision: 1)". Downloading https://dl.google.com/android/repository/platform-32_r01.zip "Install Android SDK Platform 32 (revision: 1)" ready. Installing Android SDK Platform 32 in ~/Android/Sdk/platforms/android-32 "Install Android SDK Platform 32 (revision: 1)" complete. "Install Android SDK Platform 32 (revision: 1)" finished.
The SDK path is
~/Android/Sdk, and it did already have SDK Platform 33.
Gradle took another few minutes, ostensibly building stuff, before I was able to view what files had been created for me.
When the project was ready I got a notification that performance would be imroved if I increased my maximum heap size from 1280MB to 2048MB. Of course I will do this; JetBrains IDEs are memory intensive, and worth it.
I now proceed to import my old code like I would from any other JetBrains (or Android Studio) edition. Only "Chipmunk" has another idea which got me thinking:
This is incredibly useful. I can finally just browse source code in an IDE without worrying what the build script will be doing to my system:
Preview in Safe Mode: in this case, IntelliJ IDEA opens a project in a "preview mode" meaning you can browse the project's sources, but it might be unsafe to execute any tasks or goals, build, or run your project.
IntelliJ IDEA displays a notification on top of the editor area, and you can click the Trust project… link and load your project at any time.
Even if I do trust my own project isn't malicious, I'm nowhere near skilled enough to ensure that what gradle runs on project startup isn't going to crash all my other IntelliJ products. Which was just what happened.