How to compile and run MIT App Inventor 2 on Debian GNU/Linux systems and derivatives

So, you want to compile and run MIT App Inventor 2 on your own machine.
Perhaps you do not want to have to submit to Google (you really
shouldn’t use Google, by the way- read this for just a few reasons
why). Perhaps you do not want to engage in service as a software
substitute (which you also really should not do, read this
to learn more about the issues behind SaaSS, and why SaaSS is harmful
to computing which respects the user’s freedom and autonomy). Perhaps
you simply wish to engage in a technical exercise and show off your
lovely local AI2 server to your friends. If you have them.

But I am not here to judge (as much as I would like to). It is mine not
to make reply, mine not to question why, mine but to do and die. And so
I present to you my (hopefully) short guide to AI2 compilation on
Debian 8 systems (although this should work with perhaps minor
modifications on all Debian-based systems, and especially Ubuntu-based
GNU/Linux distributions- I have done this on Debian 9 and 7 systems, as
well as Trisquel 7 systems, so I know what I’m on about).

Before we begin, I shall give credit where credit is due- to the App
Inventor people and their “excellent” (/s) documentation, upon which I
based this guide. Now repeat after me: All hail MIT for releasing App
Inventor as free software! All hail MIT for respecting the freedoms and
autonomy of the user! Good.

Now that that’s over and done with, it’s time for the guide to commence
(finally, you gasp). First you will need an assortment of software from
various places, to create a working AI environment. First, update the
package list:

# apt-get update

If you are running a 32-bit distribution of Debian, Trisquel, or the
like, the correct libraries will most likely already be there. Skip
this entire step if this is the case- if not, read on.

In order to successfully compile and run App Inventor on the amd64
architecture (alternatively referred to as x86_64), several 32-bit
compatibility libraries are required. If you are running a 64-bit
Ubuntu distribution or 64-bit Ubuntu-based distribution prior to version
14.04 (or equivalent), then simply run the following command:

$ sudo apt-get install ia32-libs

and all you require will be there. If you are running a 64-bit Ubuntu
or derivative above 14.04, then install the following packages:

$ sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0

and all will be well. If you are running a 64-bit Debian distribution,
the process is a bit more complicated. All the above compatibility
packages are present in Debian 8- except for one, lib32bz2-1.0 to be
exact. In order to get the 32-bit version of this library, you shall
have to transform your system into a multi-architecture system, or
multiarch for short, with both amd64 and i386 repositories enabled. If
you installed your system as an amd64 setup by default, you will still
install amd64 versions of packages by default, but you can also specify
the i386 version of a package to be installed by appending “:i386” (or
whatever compatible architecture) to the end of the package name. This
will enable us to install the 32-bit version of the bz2-1.0 library.

First, add the i386 architecture to your apt configuration with the
following command:

# dpkg –add-architecture i386


# dpkg –print-architecture
# dpkg –print-foreign-architectures

to verify that your system is indeed now a hybrid i386+amd64 system.
The first command will print your native architecture, and the second
any foreign architectures currently enabled which dpkg is managing. Read
the Debian multiarch
for more information.

Excellent. We are now ready to commence the installation of the
compatibility libraries (note this step only applies to 64-bit
multiarched Debian systems!). First, update the package lists.

# apt-get update

Then, install the libraries (at long last!)-

# apt-get install lib32z1 lib32ncurses5 libbz2-1.0:i386

Now for the next step- installing some other necessary software.

# apt-get install python git ant openjdk-7-jdk

The final piece of software we shall require is the Google AppEngine
SDK for Java- this is a necessary piece of the infrastructure to
successfully compile and run App Inventor, and is (to the best of my
knowledge, feel free to email me at the address on the right to correct
me) free software under the Apache 2.0 License. (If it was not, I would
not be recommending it). Download the SDK with the following command:

$ wget

Some may be puzzled as to why I do not recommend that my readers
download the latest version of the SDK, 1.9.30 at the time of writing.
This is because 1.9.27 is the latest version that has been verified to
work by the App Inventor team- there appears to be some cryptic problem
with versions 1.9.28 and above. For the time being, 1.9.27 or 1.9.26
should be used- and I have had success with these versions in the past
myself. Feel free to give it a go with 1.9.30 or above- and feel free
to tell me if you manage to get it working. If, on the other hand, you
just want the thing to work for the time being, then use the version I
recommend- 1.9.27. It is almost 160 MB in size, so this should take some
time. When the download is complete, unzip the file to a directory of
your choice. I will be using the folder ~/App-Inventor to store all of
this stuff, but the choice is yours. I downloaded the zip file the
~/App-Inventor directory, and then extracted it with

$ unzip

whereupon a new directory was created with the respective files within.

Excellent. We may now clone the Git repository and compile App Inventor. Navigate to the directory you wish to keep the App Inventor sources, and run the following command to clone the repository:

$ git clone

The App Inventor source tree is, in its entirety, quite large (it contains, at the time of writing, over 40000 objects). Be patient, as the download may take a while.

When the process is complete, navigate the folder you just cloned into (it should be called appinventor-sources), and run the following command:

$ cp sample-.gitignore .gitignore

This will put the .gitignore file into effect and prevent generated files from being added to the git index. Note that (since it is prefixed with a .) the file will be hidden both in the terminal, and in file managers by default. In order to view it, add the -a flag to the ls command, like so:

$ ls -a

in order to view hidden files. It is now good practice to clean out the source tree, just in case some junk has crept in that could get in the way. Navigate to appinventor-sources/appinventor and run the following command:

$ ant clean

Now simply run

$ ant

to compile MIT App Inventor 2. The compilation process should take several minutes (usually about 5- it took 5 minutes 36 seconds on my i5 system), and conclude by printing the words BUILD SUCCESSFUL.

Now is the time to set up a few scripts so that both App Inventor itself and the build server can be run easily, possibly at login. Copy the following lines into a text file (I’m saving mine as start-appserver in the parent folder to the App Inventor parent folder):

nohup /home/moxalt/App-Inventor/appengine-java-sdk-1.9.27/bin/ –port=8888 –address= /home/moxalt/App-Inventor/appinventor-sources/appinventor/appengine/build/war/ > serverlog.out &
cd /home/moxalt/App-Inventor/appinventor-sources/appinventor/buildserver
nohup ant RunLocalBuildServer > ../../buildserver-log.out &

Then run

$ chmod +x start-appserver

to make it executable. Now feel free to create a shortcut to this shell script so that you can launch App Inventor more easily in the future. Open a JavaScript-capable web browser (Firefox should do the trick) and navigate to localhost:8888, where you will be able to log in unencumbered. To find out more status information about the build server, navigate to localhost:9990/buildserver/vars, and to confirm that the build server is up, navigate to localhost:9990/buildserver/health.

I will release a follow-up article about how to set up connections for testing over USB using the App Inventor Companion and setup software.


Comments are closed.