0

Hello kind people of the internet.

My name is Paul.

I've started to learn Android development using Kotlin, lately I've been following a couple of tutorials regarding RecyclerView, LiveData and Lifecycle.

At first I honestly forgot to declare the dependencies inside my gradle script. But I have discovered that the functionality actually works as expected.

Can somebody please explain to me this phenomenon:

  • is it because Android Studio "saw" my imports and automatically "defined" and downloaded the dependencies ?
  • is it because of the compileSdk version?

Here is a sample of my dependencies block from one of my projects

dependencies {

    implementation 'androidx.core:core-ktx:1.7.0'
    implementation 'androidx.appcompat:appcompat:1.4.1'
    implementation 'com.google.android.material:material:1.5.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

Also here is my config

defaultConfig {
        applicationId "com.example.myrecycler"
        minSdk 23
        targetSdk 32
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

Thank you!

Paul
  • 26
  • 3
  • The Android Studio auto detect the dependency components which are required by your code and let's you ask whether to mention it in gradle or not. This is the core advantage of using androidX with latest Android Studio. – Rohit Patil May 05 '22 at 06:27
  • First of all, thank you, Rohit. I understand, it's very interesting. I haven't saw any mention of this and I was just curious. – Paul May 05 '22 at 07:19

0 Answers0