关于API 35适配中PermissionsRationaleActivity不被识别的问题咨询
Hey there! Let's work through this PermissionsRationaleActivity issue you're hitting with API 35. I've run into similar quirks before, so here are some practical things to check:
Verify your AndroidX dependencies are up-to-date
PermissionsRationaleActivity is part of the AndroidX Activity library, so if you're using an older version of the library, it might not include this class for API 35. Head to your module-levelbuild.gradlefile and make sure dependencies likeandroidx.activity:activityare at a version compatible with API 35 (aim for1.8.0or higher). For example:dependencies { implementation 'androidx.activity:activity:1.8.2' implementation 'androidx.appcompat:appcompat:1.6.1' }Double-check the full class path in your manifest
It's easy to miss part of the package path. The correct fully qualified name for this activity isandroidx.activity.result.contract.PermissionsRationaleActivity. Make sure you haven't abbreviated or misspelled this in yourAndroidManifest.xmlfile.Clear Android Studio's cache
New IDE versions (like Narwhal 2025.1.1) can sometimes hold onto outdated cache data that causes class recognition issues. Go toFile > Invalidate Caches...and selectInvalidate and Restartto refresh everything.Confirm Java SDK compatibility settings
Since you're using Java SDK 21, ensure yourbuild.gradleis configured to match this version properly. Add or update these lines in theandroidblock:compileOptions { sourceCompatibility JavaVersion.VERSION_21 targetCompatibility JavaVersion.VERSION_21 }This ensures your project is using the correct Java version that aligns with API 35 and AndroidX libraries.
Cross-check the documentation's version context
Sometimes official docs might reference components from preview library versions or specific API branches. Double-check that the documentation page you're viewing is targeted at API 35 and the corresponding stable AndroidX library versions.
Hope one of these fixes gets things working for you! Feel free to follow up if you need more details on any step.
内容来源于stack exchange

