Gradle Management: Different types of Dependency handlers - devrath/RunTracer GitHub Wiki

Dependency Handlers in Android Kotlin Project

Handler Usage Purpose Scenarios
implementation implementation "dependency" Adds dependency to compile and runtime classpath. Most common. Use for dependencies needed by the module itself.
api api "dependency" Adds dependency to compile and runtime classpath and exposes it to dependent modules. Use when the dependency should be exposed to modules that depend on this module.
compileOnly compileOnly "dependency" Adds dependency to compile classpath only. Use for dependencies needed only at compile time, such as annotations processors.
runtimeOnly runtimeOnly "dependency" Adds dependency to runtime classpath only. Use for dependencies needed only at runtime, such as logging frameworks.
testImplementation testImplementation "dependency" Adds dependency to both compile and runtime classpath for the test source set. Use for test dependencies, such as JUnit or Mockito.
testCompileOnly testCompileOnly "dependency" Adds dependency to compile classpath of test source set only. Use for compile-time dependencies needed only for tests.
testRuntimeOnly testRuntimeOnly "dependency" Adds dependency to runtime classpath of test source set only. Use for dependencies needed only at test runtime.
annotationProcessor annotationProcessor "dependency" Adds an annotation processor to the project. Use for dependencies that process annotations at compile time, such as Dagger or Room.
kapt kapt "dependency" Adds an annotation processor specifically for Kotlin projects. Use when using annotation processors with Kotlin, such as Dagger or Room.