-1

I am trying to create a library project to reuse certain things which are common in many applications like splash screen, login screen, asynchronous thread calls for getting data from a URL, custom listView, DAO files, etc.

I want to import this library and then just call the method from this library. Is it possible? If yes, then how to approach for it?

Thanks in advance!

2 Answers2

0

Yes if using Android Studio: mark your module as library using Gradle:

apply plugin: 'com.android.library'

Once build, you'll find an AAR file in build/outputs/aar/.

You can then include it in other projects using Gradle:

dependencies {
    compile(name: 'filename', ext: 'aar')
}

No if using Eclipse: because the ADT plugin does not support it and probably won't since Android Studio 1.0.0 final came out.

https://code.google.com/p/android/issues/detail?id=59183

shkschneider
  • 17,833
  • 13
  • 59
  • 112
0

Yes, you can create your own library if you are using Eclipse IDE.

Create new project and mark that project as library.As shown in the image 

enter image description here

  Create your classes and method in this project.

Now, How to use or include this library in your other projects. See this snapshot

enter image description here

Note: Make sure your both projects are present in same workspace.

After adding your library project you can use methods defined in the classes of your Library.

A.R.
  • 2,631
  • 1
  • 19
  • 22