title: Gradle: compileOnly and runtimeOnly
body: <p>I'd read the <a href="https://docs.gradle.org/current/userguide/java_library_plugin.html#sec:java_library_configurations_graph" rel="noreferrer">documentation</a> but I'm not able to understand how to create a working example to understand better their differences.</p>
  
  <p><a href="https://i.stack.imgur.com/Eh7jn.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Eh7jn.png" alt="enter image description here"></a></p>
  
  <p>And ofc I've created a playground project to check what happens when I use one or another.</p>
  
  <p>app.gradle</p>
  
  <pre><code>dependencies {
      implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$rootProject.kotlin_version"
      implementation 'androidx.appcompat:appcompat:1.1.0'
      implementation 'androidx.core:core-ktx:1.2.0'
      compileOnly project(":compileonlylibrary")
      runtimeOnly project(":runtimeonlylibrary")
  }
  </code></pre>
  
  <p>MainActivity.kt</p>
  
  <pre><code>class MainActivity : AppCompatActivity() {
  
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          setContentView(R.layout.activity_main)
          FooCompile() // this crash in runtime
          BarRuntime() // this doesn't compiles obviously
      }
  }
  // FooCompile belongs to compileonlylibrary
  // BarRuntime belongs to runtimeonlylibrary
  </code></pre>
  
  <p>And that's it, I'm stuck here, I'm not able to create a proper example in order to improve my knowledge of Gradle configurations.</p>
  
  <p>Could someone give me a hand? I can provide more details if needed. </p>