0

I am developing a library project. Right now my debugging process is something like this :

  • Make some changes in library code
  • build it into an aar file
  • use the aar file in main app project as new library module
  • then debug the code changes in lib code.

As you can see it's a long process and takes a lot of time to debug library. What is the proper way for library development using android studio?

nayakasu
  • 889
  • 1
  • 11
  • 32

2 Answers2

2

You can do this way:

  • Add library module in same project directory like app folder : File-> new-> new module -> Android Library.
  • Add your library module name in setting.gradle (eg. include ':app',':xyz') : should be added automatically
  • Right click on your main app folder-> open module settings -> add your library as dependency to "app" (it's under module dependency).
  • Go to build.gradle file of your main project, add module like compile project (':xyz')

No need to create aar , just make changes in lib module and Run your main project and debug it .

Hope this will help you !

nayakasu
  • 889
  • 1
  • 11
  • 32
Vikas Tiwari
  • 499
  • 4
  • 11
  • This is good idea. Saved a lot of time. I have edited answer to make it clearer. – nayakasu Mar 30 '17 at 11:01
  • This defeats the purpose of sharing code. What if you have a second project which needs to use the same library? Are you going to duplicate your library code in each? – zyamys May 02 '17 at 00:10
0

I would include a demo-app project in parallel to library project:

//  /settings.gradle
include ':app', ':lib'

//  /app/build.gradle
depencency {
    compile project(':lib')
}
Jokester
  • 5,501
  • 3
  • 31
  • 39