Declare a local jar file as a transitive dependency on a library project

I have an Android application (App1) which depends on the library project (Lib1). The library project has several remote dependencies (for example, guava, support for android support, etc.) and two local dependencies, which are JAR files stored in Lib1 / libs /.

Here's what the build.gradle dependency section of Lib1 looks like:

dependencies { compile fileTree(dir: 'libs', include: '*.jar') compile 'com.android.support:support-v4:20.0.+' compile 'com.google.guava:guava:r08' } 

If I compile only the library (i.e. by running gradle assemble in the Lib1 / folder), then it compiles correctly, but when I add the library to the dependency on App1, then gradle complains that it cannot find two banks in libs / folder Lib1 .

This is build.gradle for App1:

 dependencies { compile project(':Lib1') compile 'org.apache.james:apache-mime4j-core:0.7.2' compile 'org.apache.jackrabbit:jackrabbit-webdav:2.3.6' ... } 

Is there a way to tell gradle that if a library depends on local jar files, then projects that depend on that library should also include them as dependencies? Remote dependencies work fine, but not when you have jar files in libs /.

+4
source share

Source: https://habr.com/ru/post/1208452/


All Articles