[android-studio] How to create a library project in Android Studio and an application project that uses the library project

You can add a new module to any application as Blundell says on his answer and then reference it from any other application.

If you want to move the module to any place on your computer just move the module folder (modules are completely independent), then you will have to reference the module.

To reference this module you should:

  • On build.gradle file of your app add:

    dependencies {
    ...
    compile project(':myandroidlib')
    }
    
  • On settings.gradle file add the following:

     include ':app', ':myandroidlib'
     project(':myandroidlib').projectDir = new File(PATH_TO_YOUR_MODULE)