You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

关于API 35适配中PermissionsRationaleActivity不被识别的问题咨询

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-level build.gradle file and make sure dependencies like androidx.activity:activity are at a version compatible with API 35 (aim for 1.8.0 or 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 is androidx.activity.result.contract.PermissionsRationaleActivity. Make sure you haven't abbreviated or misspelled this in your AndroidManifest.xml file.

  • 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 to File > Invalidate Caches... and select Invalidate and Restart to refresh everything.

  • Confirm Java SDK compatibility settings
    Since you're using Java SDK 21, ensure your build.gradle is configured to match this version properly. Add or update these lines in the android block:

    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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.07 10:59:52