The problem with solutions listed above is that you will end up with a clone of the library project in the app using the library. This complicates making updates to the library because you need to remove and re-import the module when you make changes.
The solution I found can use the library project directly from outside folder and it does not clone the original library files.
The solution is easy...
In settings.gradle add the following lines:
include ':commonwidgets'
project (':commonwidgets').projectDir = new File(settingsDir, '../SharedWidgets/commonwidgets')
and in the build.gradle dependency section add:
implementation project(path: ':commonwidgets')
Note: commonwidgets is the name of my library, you should replace the name and path according to your library name and path.
I hope this helps someone...
I really would have liked to have the library import from GitHub bit I refuse to pay $9/month for jetpack for private libraries.