building the Android ADAL library–and the toolchain required

Remembering JUST why I abandoned Unix, the ego cult, the fact that all American unix programmers of any repute where tied into DARPA CIA/NSA, and the endless “required knowhow” in order to still make 1 + 1 = 2, we went back in time, 10+ years, and tried to compile something – the android ADAL library. From source. Of course, one has to first spend hours learning to get the tool chain fixed .. that enables  compilation.

Remember Microsoft, this is WHY we go through the pain of learning Windows dogma (once) – so we don’t have to all this! Endlessly.

So first, on MAC OS (lets not even think about doing it on the hated-windows) first we install maven, using vi (which I still remember well, from 30 years ago). And then we follow the instructions to update the android SDK/buildtools/SDKtools/Eclipse or something else to work together.

Screen Shot 2014-05-31 at 1.32.50 PM

yes we have confirmed that we have all packages of the android SDK (build tools and various other tool like things) installed, and the installer even did something right, in the platforms directory (which it might not, depending on how its feeling today, apparently).

Screen Shot 2014-05-31 at 1.39.21 PM

It was a miserable experience. The key is to happen to know that in your .bash_profile needs to export ANDROID_HOME with a variable that includes the /sdk element added to the end of the download path of the expanded tarball.

Screen Shot 2014-05-31 at 2.01.09 PM

Remember this is based on using a variant of the shell I abandoned after Unix System 7 became BSD 2 and later SunOS 4, in 1983/1987…, and instructions even had me use the vi(1) tool (that I learned the hard way, 30 years ago – being actually useful on a UK quality consumer-grade 300 baud modem over a voice circuit set for spying). Remember that Turing had a 20kbps teleprinter line to Arlington Hall and the Washington Navy Yard (where I got to work…for a bit in the very rooms where bombes had once worked). Back in 1945…(never mind 1983)  folks were sending automated job orders to remote Turing bombes… using a synchronous GGCS-Tunny-like electronic cipher machine capable of working at those baud rates…. Meanwhile back in the UK…in the 1980s…

ok. So does our Android IDE/SDK now build things using the maven-style makefile?

So I cannot answer that question yet, but I can run a fancy make(1) job (known as mvn(1) , now) on the ADAL library:

Screen Shot 2014-05-31 at 2.08.59 PM


Lets stop trying to follow the broken English in the instructions (which just makes the half-sensical technical references with steps-to-do even worse than the norm). Let’s just tryout the helloApp samples (that should link against the adal DLL/jar just built by maven.).

Screen Shot 2014-05-31 at 4.50.15 PM

in empty workspace, sue the  ‘import’ project – existing android code.

Screen Shot 2014-05-31 at 4.53.18 PM

Screen Shot 2014-05-31 at 4.54.58 PM

note I opted out of the importing of the second project, above.

To build the source we need to clean up a little and get things linking.

First remove the reference to the project we just avoided loading in to the IDE.

Screen Shot 2014-05-31 at 4.58.45 PM


Then we add a lib folder to the project, and import (using the file system) the adal library stored in a jar file.

Screen Shot 2014-05-31 at 5.00.19 PM

once created, we right click on the lib directory in order to import a jar file

Screen Shot 2014-05-31 at 5.01.37 PM

Screen Shot 2014-05-31 at 5.02.57 PM

Screen Shot 2014-05-31 at 5.04.13 PM

Finally, we can now refer to the library file as a linkable resource, by using control right click on the project to get to the properties and the load path:

Screen Shot 2014-05-31 at 5.05.29 PM

Then we repeat the lib (import and reference) process for “GSON” (which we downloaded from here ).

Screen Shot 2014-05-31 at 5.08.25 PM

Now we have compiled and linked!

Screen Shot 2014-05-31 at 5.11.06 PM

note the strange absence of the valus in lib/ – once one performs a build reference to the lib.jar file.

Of course, running it is problematic too! To accomplish that, we do as we mentioned in our previous post: we add a throwaway project built using the add (android application) project wizard. Once that  runs, we get when running our own testapp:

Screen Shot 2014-05-31 at 5.23.44 PM


giving (finally!)

Screen Shot 2014-05-31 at 5.25.51 PM


About home_pw

Computer Programmer who often does network administration with focus on security servers. Sometimes plays at slot machine programming.
This entry was posted in Azure AD. Bookmark the permalink.