From the quoted documentation:
it is strongly recommended to use the Activity Result APIs introduced in AndroidX Activity 1.2.0-alpha02 and Fragment 1.3.0-alpha02.
Neither of those are in your dependencies, at least the portion from your question. You have been manipulating appcompat
, not activity
or fragment
.
Add either or both of:
implementation "androidx.activity:activity:1.2.0"
implementation "androidx.fragment:fragment:1.3.0"
(or any higher versions)