I'm getting a `none of the following candidates is applicable because of receiver type mismatch` for...
j
I'm getting a
none of the following candidates is applicable because of receiver type mismatch
for
ComponentActivity.viewmodels
and
ComponentActivity.setContent
, even though I am invoking these inside an Activity that extends
AppCompatActivity
, and should have access to
ComponentActivity
. My code is able to run fine even though these errors pop up in the file. Any way to get rid of this incorrect error?
i
You should probably file an issue against Android Studio if Studio is complaining but it actually builds correctly (https://issuetracker.google.com/issues/new?component=192708 is where you'd do that)
But generally for these kind of cases, adding more explicit dependencies in the module you are having issues with (e.g., an explicit dependency on androidx.activity and/or androidx.fragment (which is the layer between Activity and AppCompat) and AppCompat too if you don't have a direct dependency on that in that module) can help it figure out what APIs are actually available
j
I'll try both, thanks
l
What version of AS? I saw this in Chipmunk a lot
j
Android Studio Electric Eel | 2022.1.1 Patch 2
a
best asked in #compose-android not #compose
294 Views