Unresolved reference. None of the following candidates is applicable because of receiver type mismatch

Button you are accessing is inside your fragement but your are accessing it directly. You should access it via parent view like we do with java rootview.findViewById() so use

view.detailButton.setOnClickListener {
    findNavController().navigate(R.id.action_welcomeFragment_to_detailsFragment)
}

I had this issue and figured out that the root cause was play-services with versions 17.x.x

My fix

Change

google_android_gms_version

in

implementation "com.google.android.gms:play-services-location:$google_android_gms_version"
    implementation "com.google.android.gms:play-services-gcm:$google_android_gms_version"

from 17.x.x to 15.0.1 The reason is that play services 17.x.x has dependencies on Androidx

General way Click the Gradle option in the extreme right panel, Go to app -> help ->dependencies Search androidx in the chart. Find out which library has it. Change or modify your gradle accordingly.

Those who can migrate to androidx, that well and good. If you have to keep it at appcompat, then follow the answer.


I have faced the same problem with my adapter class and finally problem solved by adding the following code to build.gradle(Module: app) file of the project.

apply plugin: 'org.jetbrains.kotlin.android.extensions'
androidExtensions {
    experimental = true
}

Since this new version of Kotlin, the Android Extensions have incorporated some new interesting features like caches in any class