Kotlin Standard Library / Scope Function / Unresolved reference: apply / (binding.apply)


In chapter 9 I have some trouble when writing the scope function .apply to the binding in CriminalDetailFragement.kt.

I was able to solve the problem by changing the version in my build.gradle from

implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.8.0'

to this:

implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'

I understood .applyis a scope function included in Kotlin Standard Library. But why do I need to downgrade the above implementations to use Kotlin Standard Library in my code??? Any explanation is much appreciated! :slight_smile:

You are correct in that apply is in the Kotlin standard library, so it should be unaffected by this issue. Without looking at your entire project, I cannot say for certain what the issue was. But I am glad you were able to work around it.