Getting the Android SDK working under Arch Linux

14 June 2018 on guides. 2 minutes

I for the past few months have been using the program Ionic to make an application. Disregarding the fact that I’m using typescript (think javascript but somehow more annoying to use), today I had to build my application into an APK. As I’m using Manjaro, I was trying to set up the Android SDK packages in the AUR, before quickly running into some issues. So here’s a quick guide on how to get the Android SDK working under Arch based distros (Arch based since Manjaro is basically Arch without the pathological need to -Syu daily. No you do that weekly instead.)

Step 0: Get an AUR helper

Okay so before I continue any further, you can do this entire installation without using a helper. In fact, if you’re not familiar with how Arch Linux packaging works, it might even be preferable to not use one, as learning what the various helpers do is a rather essential part of using the AUR. Here is a great place to get you started. That said, a helper is recommended. Of all the various helpers out there, at the moment I recommend pacaur, although it’s been deprecated for over 6 months now, it’s the helper that provides pacman style syntax and functionally acts as a drop-in replacement for pacman (you can replace any guide that tells you to do “sudo pacman” somewhere with simply “pacaur”.

The main reason you want to know what a helper does is in case one of the packages (or it’s dependencies) break in the AUR. By far the most common cause for package breakage is usually not updating checksums, and knowing how to fix that and manually install the update is an incredible help.

Step 1: Install the appropriate packages

Very simple. Just use your favorite helper to install the following packages (or use makepkg, whatever floats your boat really). This is pretty straightforward.

The packages you need are:

android-sdk android-sdk-build-tools android-sdk-platform-tools android-platform

Optionally, if like me you are using Ionic, you’ll also want to install gradle, but this is not an AUR package.

Step 2: Set the environment variables

Add the following line to your bashrc/zshrc/etc:

export ANDROID_HOME=/opt/android-sdk

Step 3: Accept the licenses

This for me was the most annoying step, as this is not documented on the Arch Wiki, but on StackOverflow but you’ll need to do the following things.:

chmod -R 777 /opt/android-sdk

./sdkmanager –licenses

(type yes a couple times)

Afterwards it should work. As to why you set android-sdk to 777, it’s because when I used ionic, gradle still had to download the Android SDK itself, and it lacked permissions to do that. There’s probably a better solution, but this worked for me.

Hope it’s useful to someone out there.


Previous

Boss Design in Dark Souls

Dark Souls is one of the most entertaining games I’ve played in the past few months. While I haven’t beaten the game yet, I’ve been meaning to look for an excuse to talk about it for a bit, and I want to draw attention to one of it’s biggest strengths: it’s boss design.

Next

Fuck Team Xecuter

NOTICE: The following piece is even more editorialized than my normal posts are. If you think me a cunt or anything for what I’m about to rant about, then please fuck off. I don’t need your readership. Same goes for trying to do any cheap gotcha’s. Something I semi-often talk about here is homebrew. For the slightly unaware, although I don’t have the desire to go super deeply into it, homebrew is the idea of running custom code on devices that are often locked down by their manufacturers. Of course, it should go with the addendum that this specifically refers to gaming consoles, as hacking phones have their own names (Unlocking bootloader for Android, jailbreaking for the iDevice) and PCs usually aren’t locked down in any significant manner that can’t be solved with a good old partition wipe and a Linux install.