Setting Up the Azure Active Directory SDK for Android in Eclipse

Note: This post assumes that you're using Eclipse WITHOUT any dependency management system like Gradle. 

Azure Active Directory (AAD) is a service that provides identity and access management capabilities in the cloud. If you're dealing with Office 365 APIs, I can guarantee you that you will definitely run into AAD. 

I'll write another post shortly about AAD and why that's an integral part of the Office 365 authentication story, but for now, let's focus on getting the AAD Android SDK set up and configured. 

1. Go to the Azure AD library for Android repository on GitHub to download the SDK. Just click on "Download Zip" (the lower-right of the screenshot below)

2. Unzip the file. If you run into a situation when the filename is too long when unzipping, move the zip file to C:/ root and try again. This is a known problem with the default Windows unzipping tool.

Go into the unzipped folder and see all the good stuff you've downloaded.

3. Go into the src/libs folder. Open "required-libs.txt". This shows you the dependencies - namely, gson and the Android support library. Strange that you have to dig into this text file to find out the required libraries and it's not mentioned at all on the github page.

4. If you don't have it already, you can download gson here. You'll want to go for the gson-2.x.jar file. Save that file into the src/libs folder that you opened earlier in step 3.

5. Import the AAD Android project into Eclipse (Go to File > Import > Existing Android Code into Workspace)

Select the source code and sample project.

6. Notice that the project doesn't compile. There are squiggly red lines indicating dependencies that are not found.

7. Of course, we haven't yet added the Android support library. Add it by right clicking on the AuthenticationActivity project (i.e. the source code, not the sample) and then Android Tools > Add Support Library. Agree to the terms and conditions.

8. The AAD library is set up and ready to be used! To try it out, right-click on the sample project and select Run As > Android Application.