2

I have included a jar in my android project,

build.gradle

as

implementation files('libs/dependency_a.jar');

But there are dependencies with are needed by this jar file, which can be downloaded from the internet but don't get downloaded while building.

How do i get Gradle to download those dependencies automatically.

Thanks.

Sunny
  • 7,444
  • 22
  • 63
  • 104

1 Answers1

0

The dependencies won't be downloaded automatically in this case. You have to specify all the dependencies of your jar as dependencies for your app, in your app module's build.gradle file.

android {
    ...
}

dependencies {
    //Dependencies of your app
              +
    //Dependencies of your jar

}
Sagar
  • 23,903
  • 4
  • 62
  • 62
  • Is this true? Surely we don't need declare the transitive dependencies of every dependency unless the app uses those transitive dependencies directly. Can you link to documentation stating this if so? – topher217 Aug 10 '21 at 02:16
  • If this is the case, what would be the point of the `api` vs `implementation` calls discussed [here](https://docs.gradle.org/current/userguide/swift_library_plugin.html#sec:swift_library_api_vs_implementation) – topher217 Aug 10 '21 at 02:22
  • The title might be mis-leading. The question is **dependencies which are needed by this jar file, which can be downloaded from the internet but don't get downloaded while building** It's not about the app module requiring to access the transitive dependencies. But the dependencies for `.jar` were not getting fetched. If its `.aar ` then the story would have been different. – Sagar Aug 10 '21 at 07:26