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

Android Studio中重写方法显示模糊参数名(如p0/p1),求解决方案

解决Android Studio重写方法参数名显示为p0/p1的问题
  • 检查Google Billing库的源码是否下载
    你遇到的onQueryPurchasesResponse属于Google Billing Library,并非Android SDK平台源码范畴,所以下载SDK平台源码无法解决问题。打开Project Structure(快捷键Ctrl+Alt+Shift+S),找到对应的Billing Library依赖,查看是否有下载源码的选项,勾选后等待下载完成。

  • 确认依赖配置是否包含源码
    在app模块的build.gradle中,确保依赖的Billing库正确配置,必要时添加源码变体,示例如下:

    implementation 'com.android.billingclient:billing:6.0.1'
    implementation 'com.android.billingclient:billing-ktx:6.0.1'
    // 添加源码依赖(按需)
    debugImplementation 'com.android.billingclient:billing:6.0.1:sources'
    debugImplementation 'com.android.billingclient:billing-ktx:6.0.1:sources'
    

    同步gradle后再尝试重写方法。

  • 清理缓存并重新关联源码

    1. 打开File → Invalidate Caches... → 勾选"Clear file system cache and local history",点击Invalidate and Restart重启Android Studio。
    2. 重启后,找到onQueryPurchasesResponse所属的接口类(如PurchasesUpdatedListener),按住Ctrl点击类名进入定义,若仍显示p0/p1,点击右上角的"Download Sources"按钮,等待下载并完成关联。
  • 检查SDK工具配置
    打开File → Settings → Appearance & Behavior → System Settings → Android SDK,确认已安装对应版本的"Android SDK Platform"和"Source for Android SDK",同时检查SDK Tools里的"Google Repository"是否为最新版本,更新后同步项目。

内容的提问来源于stack exchange,提问作者Muhammad Sajid

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.10 16:10:27