Dependency versions

Should updated dependency or library version numbers be used in the Gradle files?

The book spells out exactly what version of dependencies were used in the text. So for example… from Chapter 26 Listing 26.1 Becoming a composer (app/build.gradle):

...
    dependencies {
        ...
        implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
        
        implementation 'androidx.compose.foundation:foundation:1.1.1'
        implementation 'androidx.compose.runtime:runtime:1.1.1'
        implementation 'androidx.compose.ui:ui:1.1.1'
        implementation 'androidx.compose.ui:ui-tooling:1.1.1'
        implementation 'androidx.compose.material:material:1.1.1'
        implementation 'androidx.activity:activity-compose:1.4.0'

Is it OK to use the newer version numbers that are given by android studio? For the above example I’m being prompted to use the following:

implementation 'androidx.core:core-ktx:1.10.1'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.compose.foundation:foundation:1.4.3'
implementation 'androidx.compose.runtime:runtime:1.4.3'
implementation 'androidx.compose.ui:ui:1.4.3'
implementation 'androidx.compose.ui:ui-tooling:1.4.3'
implementation 'androidx.compose.material:material:1.4.3'
implementation 'androidx.activity:activity-compose:1.7.2'

or should I stick with the versions described in the book?

Summary

Should updated dependency or library version numbers be used in the Gradle files?

In the real world, you want to use the latest stable library versions, but in order to make the learning process as straightforward as possible, I think its a good idea to stick with the versions in the book.

Work through the book with versions we list and then after you are done with the project, try upgrading the libraries to the latest versions. There have been some improvements that have been made in the past year since the book was published.

I’m also facing the same issue. Did you got the solution for that?