Gradle include dependency dependencies

Scenario

I have two Android libraries:

  • Library A
  • Library B

Library B depends on library A and includes it from the build.gradle file.

My Android application needs to use library B and some base classes from library A. The only success I had in this was to include both libraries in my Android build.gradle application and set the transition to false.

Question

Is there a way to add only the B library and access its dependencies from my Android application?


Android Studio

Android Studio 3.1 Canary
Build #AI-171.4415322, built on October 24, 2017
JRE: 1.8.0_152-release-1012-b01 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.12.6

Gradle

3.1.0-alpha01
+4
source share
2 answers

This is called a transitive dependency.

Gradle, . B A, A. A, , B .

A , . , . , - ,

include B(v1.0) -depends on-> A(1.0)
include A(1.1)

, A ? A 1.0 1.1? .

  • A 1.0, YOU 1.1, 1.0.
  • 1.1, B 1.0, 1.1 .
+1

, A A, B, implementation project(':LibA'), .

B, api, api project(':LibA').

api , ( ). Vice Versa implementation ( ).

0

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


All Articles