OK I found the answer by myself:
You must not add the external library as an existing module. It will make a copy of it under your project folder.
What you have to do is:
- Delete the library folder in your current project. (You can also delete the
./idea/modules/[module_name]folder.) - Open the
setting.gradlefile and add these:
include ':your_external_library_module_name'
project (':your_external_library_module_name').projectDir = new File('../path/to/your/external/library')
include ':perhaps_second_external_library'
project (':perhaps_second_external_library').projectDir = new File('../path/to/your/second/external/library')
- In your
build.gradle (:app)file add dependency as:
dependencies {
implementation project(':your_external_library_module_name')
implementation project(':perhaps_second_external_library')
}
- Sync the project and you are done.