Android Lint Message: Update to Fragment 1.3.0 to use ActivityResult API error in Analysis/ Inspect Code

When running Android Studio/ Analyze/ Inspect Code… I get 50+ identical error messages “Android/Lint/Correctness Error Upgrade Fragment version to at least 1.3.0” on this line of code:

class MainActivity :  AppCompatActivity() {...

registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->...

The code breaks on breakpoints, so code is called and the application works correctly.

Build gradle includes (Kotlin language)

implementation "androidx.activity:activity-ktx:1.2.1"
implementation "androidx.fragment:fragment-ktx:1.3.1"
debugImplementation "androidx.fragment:fragment-testing:1.3.1"

I want to FIX the error message (not hide it). Since the code works correctly, and I use fragment-ktx:1.3.1 what should I be looking for?

Answer

This has been reported on Google’s Issue Tracker and, I quote:

This has been fixed internally and will be available in the next Activity release.

Source: https://issuetracker.google.com/issues/182388985#comment9

Leave a Reply

Your email address will not be published. Required fields are marked *