First of all, I explain my project setups. I use the words Project/Module as used in Android Studio.
I have a setup of my projects like following:
LibraryProject => a project that just groups my libraries, that I use in other projects, if necessary
- BackupLibrary (Module)
- DatabseLibrary (Module)
- MainUtilityLibrary (Module)
- DialogLibrary (Module)
MyProject1
- App (Project)
- DialogLibrary (Module, referenced from DIRFFERENT project)
My Project1 now looks like following:
1) I reference the module from the other project, that I want to use (done in settings.gradle (Project Settings)
file:
include ':app'
include ':dialogLibrary '
project(':dialogLibrary ').projectDir = new File(settingsDir, '../LibraryProject/DialogLibrary ')
2) I add the foreign library module as a dependency to my app's build.gradle
:
dependencies {
compile project(':dialogLibrary ')
}
My LibraryProject looks like following:
I add the repository and the dependency directly to the module's `build.gradle' (this is enough to build the module on it's own without a problem):
allprojects {
repositories {
maven { url 'https://dl.bintray.com/drummer-aidan/maven' }
}
}
dependencies {
compile 'com.afollestad:material-dialogs:0.7.5.2'
}
Problem
The setup so far does not work for MyProject1. I have to add maven { url 'https://dl.bintray.com/drummer-aidan/maven' }
to MyProject1 as well, the compile project(':dialogLibrary ')
is not enough. I have to add the dependency that should somehow be inherited from the LibraryModule to MyProject1 Project build.gradle
again like following:
allprojects {
repositories {
mavenCentral()
maven { url 'https://dl.bintray.com/drummer-aidan/maven' } // com.afollestad:material-dialogs
}
}
Otherwise, i can't compile my project. This way seems like doing something twice that probably can be done automatically. But how? This way, whenever I include a module from my LibraryProject, I have to check if I need an additional maven repo...