Reputation: 1717
I have an Android application using an Android library. The library is a pretty big open-source project on GitHub, and its authors publish the artifacts to Bintray. I can specify the dependency with the usual syntax dependencies { implementation 'group:artifact:version' }
in the app's build.gradle
.
Now I want to change some code in the library. I git clone
it on my machine, I make my changes, then I build the library. But how can I tell my app to use the library I built locally, instead of the one in Bintray?
I don't want to follow the approach in Gradle Local Project Dependency, because that means that the library code is now part of the application project, but I really want to keep things separated.
I think the solution involves publishing to a local Maven repository. I followed the guide at https://proandroiddev.com/tip-work-with-third-party-projects-locally-with-gradle-961d6c9efb02 but the app's Gradle is still picking the original library from Bintray.
Upvotes: 1
Views: 1015
Reputation: 1717
Bintray-based projects have the install
task. That's the one to be used instead of publishToMavenLocal
.
When using install
, the artifact version is automatically set to X.X.X
before publishing to the local repository. Therefore, in order for the app to pick up the local library, you have to edit the implementation
row to group:artifact:X.X.X
.
As the guide https://proandroiddev.com/tip-work-with-third-party-projects-locally-with-gradle-961d6c9efb02 suggests, you also need to add mavenLocal()
as the first entry in the repositories
section in the top-level build.gradle
of the application.
Upvotes: 1