Skip to content

Instantly share code, notes, and snippets.

@ardok
Last active December 17, 2015 13:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ardok/5616806 to your computer and use it in GitHub Desktop.
Save ardok/5616806 to your computer and use it in GitHub Desktop.
Tutorial to setup StackMobAndroid SDK in Android Studio
Mac OS instruction:
* Download and install <a href="http://developer.android.com/sdk/installing/studio.html" target="_blank">Android Studio</a>
* Open Android Studio and select one of the options shown (for simplicity, this instruction selects New Project -> Blank Activity)
* Setup the name of your project, launcher icon, and other stuff that it asks you to
* In this instruction, the name of the app is `StackMobAndroidSDKTest`
* After the project window is open, add StackMob Android SDK into the `libs` directory <img src="https://s3.amazonaws.com/static.stackmob.com/images/android/as_sm_android_libs.png" style="margin: 20px 0 20px 0;" />
* Right click on the StackMob Android JAR file and select `Add as Library...` -> `OK` <img src="https://s3.amazonaws.com/static.stackmob.com/images/android/as_sm_android_add_as_library.png" style="margin: 20px 0 20px 0;" />
* Open `build.gradle` under `src` directory and add `compile files('<path_to_stackmob_android_sdk>')` <img src="https://s3.amazonaws.com/static.stackmob.com/images/android/as_build_gradle.png" style="margin: 20px 0 20px 0;" />
* Fire up your terminal and go to the root directory of your project (your default project directory location is `/Users/<your_name>/AndroidStudioProjects/`). Then type `./gradlew clean`.
* After you do gradlew clean, your `R` object might be red colored by Android Studio, but it's OK! As you may already know, `R` object is generated automatically. Thus, all you need to do is just run your project and the devil red color on `R` object will disappear!
* As usual, you need to add internet permission and initialize StackMob object with your public key as shown <a href="https://dashboard.stackmob.com/sdks/android/config" target="_blank">here</a>
* Your project should run with StackMobAndroid SDK!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment