Update for Android Studio
Convert application module to library module
If you have an existing application module with all the code that you want to reuse, you can include it in the library module as follows:
Open the build.gradle file for an existing application module. At the top you will see the following:
apply plugin: 'com.android.application'
Change the purpose of the plugin as shown below:
apply plugin: 'com.android.library'
Click Sync Project with Gradle Files .
What is it. The whole structure of the module remains the same, but now it works like an Android library, and the assembly will now create an AAR file instead of the APK
Read more about Create an Android library and how to Convert an existing project to a library project in Android Studio
Following are the steps for Eclipse
Steps
Right click on project -> property -> Android -> check 'Is library' check box -> OK
What is it.
source share