0

I created android application and need to converted it to library.
I changed module build.gradle file by changing

id 'com.android.application'  

to

id 'com.android.library'

and it works great.
But for adding new features a need to convert it again to app.
I can use 2 files build.gradle and build.gradle.app and change between them,
but the question is what is the best practice for managing both app and library in the same project

Costa Mirkin
  • 947
  • 3
  • 15
  • 39

1 Answers1

0

If you want to test your library, then you need to have a project in which there will be two modules. The first (library) is the library itself and the second module(sample) is the project to which you link this library. In sample you can check all the new functions of your library.

library module - id 'com.android.library'

sample module - id 'com.android.application'

and inside sample build.gradle add this, to connect the library

dependencies {
...
    implementation project(':library')
...
}

This is how the project structure looks like

enter image description here

Sergei S
  • 2,553
  • 27
  • 36