I have a project with multiple modules and one module uses other modules functions. So, the module with dependencies has the jar file in compile dependencies. So when I try to go to the source, it goes to the .class file from the jar. Instead I want it to go to .java file of the dependent module.
One way is to manually do AttachSources.
Since, I have multiple modules with multiple dependencies;
Project Structure:
ProjectA :
and many more modules.
In order to access the modules' sources from your project, instead to import a jar, you will have to use compile project (':module')
.
For example, if I have to build your structure, it will look like this:
ProjectA: (under com.example.projecta)
dependencies {
... //Other dependencies(appcompat, jar files...)
compile project (':moduleaa') //Dependent of moduleAA
...
}
ModuleAA: (under com.example.moduleaa)
dependencies {
...
compile project (':moduleab') //Dependent of moduleAB
...
}
ModuleAB (under com.example.moduleab)
dependencies {
...
compile project (':moduleac') //Dependent of moduleAC
...
}
ModuleAC (under com.example.moduleac)
dependencies {
...
}
Now the ProjectA can access to any modules and their dependencies.
To navigate between your project and the source code of your modules, you can use the short key to show the source. You can find the keymap under: File > Settings > Keymap > Main menu > View > Jump to source ( or Show source)
. (usually control + left click, or F12).
EDIT
If you have a module in an other project that you what to import and be able to modify as if it is a module on your current project, you can modify your settings.gradle of this current project with:
include ':module'
project(':module').projectDir = new File("/<path_to_module>/other_project/module")
Then the module will appear in your current project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With