Disclaimer: This is dumb. If anybody knows a better way, I'm all ears.
You have two Android projects. One is a library and one is an app that depends on that library. Both are on your local machine.
Now, say you want to test the library in the app before you publish it. Here's what you do.
You have an app and a lib:
.
├── myapp
│ ├── MyApp
│ ├── MyAppTest
│ └── MyAppTestApp
└── mylib
├── MyLib
├── MyLibTest
└── MyLibTestApp
Make whatever changes to MyLib
that you want to test in MyApp
. Then add the following lines to myapp/settings.gradle
:
include 'mylib'
project(':mylib').projectDir = new File('/absolute/or/relative/path/to/mylib/MyLib')
Then change the dependency declaration in myapp/MyApp/build.gradle
to:
dependencies {
// ...
compile project(':mylib')
}
Whereas when you publish. your dependency might look like this:
dependencies {
// ...
compile 'com.mycompany.mylib:MyLib:1.0.2'
}
Note: if you have dependencies of dependencies that you want to link (e.g. A depends on B depends on C), then be prepared for sad times. I haven't figured that out yet.