Johann
Johann

Reputation: 29877

How does Gradle include a dependency not included in build.gradle

In an Android gradle project, I see the use of a library called Koin. Normally, as in all Android projects, you include the library in build.gradle like this:

implementation "org.koin:koin-core:$koin_version"

However in this project, there is nothing in any of the gradle files that contain this. I even did a file search to see where it is defined. The only place where I have seen it defined is when you select:

File > Project Structure > Dependencies

But when I build the project, it builds without any problems. How does gradle reference this dependency since it's not in the build.gradle file? Even though it's defined under:

File > Project Structure > Dependencies

there is no clear indication how gradle knows about this.

Upvotes: 0

Views: 847

Answers (1)

Sasi Kumar
Sasi Kumar

Reputation: 13348

The dependencies can be located on your machine or in a remote repository, and any transitive dependencies they declare are automatically included as well.

dependencies {
// Dependency on a local library module
implementation project(":mylibrary")

// Dependency on local binaries
implementation fileTree(dir: 'libs', include: ['*.jar'])

// Dependency on a remote binary
implementation 'com.example.android:app-magic:12.3'
}

for more details Android build dependencies and kotlin Gradle

Upvotes: 1

Related Questions