Slackware 14.2, Ionic 2 and Android SDK

This is my first post regarding Slackware and my motivation is basically how to install an environment, that is ideal to develop, compile and deploy Ionic 2 apps. Besides, there were so many small details, that it’s easy to get frustrated. Before getting our hands dirty, I’ll show you my initial setup.

  • Slackware  14.2 stable not current.
  • Not multilib
  • Default kernel so there isn’t any funky configuration that can give problems.
  • Only the SDK is installed, meaning no android studio or similar, just the download of the required files and libraries. For this tutorial, I assume they will be unzipped in a $USER/android folder.

Let’s get our hands dirty.

First, we have to install the java jdk and node packages. These can be found in the slackbuilds site so, just download, compile, and install them. Just in case here are the links:



The next step is turning our Slackware into a multilib version. Why? Well there’s this executable called “aapt” which is linked to 32 bit libraries and the main problem here is, that when you run a command such as ionic run android and it crashes, the error message tells you little about the problem making the debugging much harder than it should be.  Anyway, this is easily achieved by following AlienBob’s instructions, which are pretty straightforward. Basically this will allow us to use 32-bit libraries in our 64-bit system. Just for the sake of understanding, here’s the quote from his wiki:

A multilib 64bit Linux system is capable of running 64bit as well as 32bit software. The Filesystem Hierarchy Standard documents the optimal method to achieve a clean separation between 64bit and 32bit software on a single system. When starting with the development of “Slackware64” (the official port to the x86_64 architecture) we chose to adopt this standard. Therefore Slackware64 has been configured to look for 64bit libraries in /lib64 and /usr/lib64 directories. This is why I call Slackware64 “multilib-ready” – even though 32bit libraries will be looked for in /lib and /usr/lib, Slackware64 does not ship with any 32bit software. There is one more step that must be taken (by you, the user) before Slackware64 can be called “multilib-enabled”.

As a friendly advice, I suggest you to read the wiki to get a better understanding of what’s going on and the caveats to this process which is important for users of Nvidia or ATI video cards.

Now we run the following commands (as a normal user)

mkdir multilib
cd multilib
lftp -c "open ; mirror -c -e 14.2"
cd 14.2

I already added the 14.2 version number but if in your case it is different just replace it. This will download several files so you can grab a snack because it’ll take some time.

Once finished run the following as super user:

upgradepkg --reinstall --install-new *.t?z
upgradepkg --install-new slackware64-compat32/*-compat32/*.t?z

And reboot.

Now we download the Android tools from its site, there we look for the Linux (as of the time of this writing) , download it an unzip it wherever you feel comfortable with, just don’t forget its path.

Now we enter the directory and we will see a lof of files and folders. Open a new terminal here. We can check the sdks available with

./android list sdk --all

Then we download them and install them running

./android update sdk -u -a -t 20
./android update sdk --no-ui

The last command is to accept the licenses, otherwise when you run ionic it will crash complaning that the license wasn’t accepted. So now go and grab a coffee, this will take some time to download.

As a word of advice, initially I had run ./sdkmanager –update because I thought that it would update my sdks. Don’t do that. It’ll mess up your folder and the files in it.

Now we install ionic and cordova globally (as root)

sudo npm install -g ionic
sudo npm install -g cordova

From now on everything is run inside our project folder. We cd into it and add the android platform for the building process. The reason I left this for the final part was that I did this at the beggining and had to remove and add it again.

ionic platform add android
ionic run android

Note that you have to add the environment variable ANDROID_HOME either temporary or to your bashrc or similar file in order for the compilation process to run. It can be set like this

export ANDROID_HOME=/my/path/to/android

 Some considerations

If the building process fails it’ll suggest to run it with the –stacktrace, –info or –debug parameters. If you do this with the ionic command it won’t provide any useful output. A way to know what’s going on, is to cd to your platform/android folder inside the project and execute

./gradlew --stacktrace build clean

You can replace –stacktrace with –debug or –info and this will show useful debug messages.

Well that’s it. Maybe these steps are kind of wrong to some more purist mobile developers but that’s what worked for me and hope it helps you to set your enviroment.