/ android

Adding an external library into Android Studio project

We needed to add Volley networking library into our project and a quick search returned the following solution:

dependencies { compile 'com.mcxiaoke.volley:library-aar:1.0.0' }

While this is great and mcxiaoke.volley has thousands of stars on github this is not the official repository.

No giving up! There is an easy way to do it using the official repository, thanks to Levit

  1. add Volley as a submodule
    git submodule add -b master https://android.googlesource.com/platform/frameworks/volley volley

  2. add Volley as a grade module in settings.gradle
    include ':volley'

  3. add Volley as a compile dependency in build.graddle (Module.app) in dependencies
    compile project(':volley')

Later, if there is a need, it is easy to update the submodule.

  1. cd volley
  2. git pull
  3. cd ..
  4. git commit -am "great new update from volley"