Using The Android BOX SDK With Android Studio

This is a guide on how to use Box’s Android SDK in Android Studio. Parts of this guide are derived from ReadMe files provided by Box, the rest is provided to fill in the blanks about how to actually do this.

Step 1: Install Gradle (OSX Mavericks)

We will need Gradle installed to build and install some key dependencies.

  • Download the Gradle 1.6 (NOT THE LATEST GRADLE, IT MUST BE 1.6 ONLY):
  • Unzip the full directory
  • Move the contents of this directory to: /Users/*****(yourname)/Developer/gradle (or your desired directory)
  • Now run “vi .bashrc”
  • Add the following lines to your .bashrc:

Step 2: Download & Build The Box Java SDK

Before you can use the Box Android SDK in Android Studio you must install the Box Java SDK V2.

Step 3: Install Maven

We must also install the Android Support Library for this to work. To do that, we must also install Maven.

  • Simply use Homebrew to get Maven: “brew install maven”
  • “mvn -v” to see if Maven is installed in the Terminal

Step 4: Install The Android Support Library

Next, time to install Android Support Library using Maven.

In my case, I use “~/Applications/Android” because this is where Android Studio installs it’s SDK by default. Here is the Maven command that worked for me (note you must wrap the path in “‘s).

Additional Note: On OSX you have two application’s directories, one at the very root path and the other under your Users folder. The below command must target the appropriate directory where you have Android Studio installed.

mvn install:install-file \
-Dfile="/Applications/Android" \ \
-DartifactId=support-v4 \
-Dversion=r13 \

This should yield the following message or something like it:

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ standalone-pom ---
[INFO] Installing /Applications/Android to /Users/rexstjohn/.m2/repository/com/google/android/support-v4/r13/support-v4-r13.jar
[INFO] Installing /var/folders/49/6kvdjbmx2_55s6mt2vbdl12r0000gn/T/mvninstall6323110116717365831.pom to /Users/rexstjohn/.m2/repository/com/google/android/support-v4/r13/support-v4-r13.pom
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.448s
[INFO] Finished at: Sun Dec 01 14:20:37 PST 2013
[INFO] Final Memory: 3M/81M
[INFO] ------------------------------------------------------------------------

Step 5: Build the BOX SDK

If you haven’t already, download the Box Android SDK (This is a totally separate SDK from the BOX Java SDK we installed earlier, which is also required).

Download, unzip (or use Git to fetch) the BOX Android SDK directory and navigate to the “BoxAndroidLibraryV2” folder using the terminal.

You may need to add a “” file into the project directory with the following variable: “sdk.dir=/Users/*****/android-sdks/”

Otherwise, set your ANDROID_HOME environmental variable in your .bashrc like so:


And then “source .bashrc” to make it official.

Now run: “gradle build” while in the BoxAndroidLibraryV2 directory, you should get the following:

:processReleaseJavaRes UP-TO-DATE
:packageReleaseJar UP-TO-DATE
:packageReleaseLocalJar UP-TO-DATE
:packageReleaseRenderscript UP-TO-DATE
:packageReleaseResources UP-TO-DATE
:bundleRelease UP-TO-DATE
:assembleRelease UP-TO-DATE
:assemble UP-TO-DATE
:check UP-TO-DATE
:build UP-TO-DATE


Total time: 11.583 secs

Finally, add the BoxAndroidLibraryV2 to your Gradle dependencies of your Android project:

dependencies {
	compile project(':box-android-sdk-private:BoxAndroidLibraryV2')

Next you will need to build in the Box SDK using a multi-project setup. You can read about how to do that here: