跳到正文
Skillpedia
移动应用10k · #11929

play-billing-library-version-upgrade

它能做什么

这个技能把 Android 项目的 Google Play Billing Library 升级或迁移到最新的稳定版本。它会找出真实的起始版本,包括已弃用的代码,并规划相关步骤。适合维护应用内购买代码的 Android 开发者。

适用场景

  • ✓当你的 Android 应用使用旧版 Google Play Billing Library,并且你想更新它的时候。
  • ✓当你的应用因使用了 SkuDetails 等已弃用的计费代码而构建失败时。
  • ✓当你需要一份分步计划,以跨越多个主要计费库版本的时候。

技能链接

https://github.com/android/skills/blob/main/play/play-billing-library-version-upgrade/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/android/skills/blob/main/play/play-billing-library-version-upgrade/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请把我 Android 应用中的 Google Play Billing Library 升级到最新的稳定版本。”

每周 5 个新技能,1 分钟读完。

工作原理

该技能会检查计费依赖的版本,然后尝试构建。如果构建失败,它会扫描已弃用的计费类,以找出真实版本。然后它会规划直接迁移或分步迁移到最新稳定版本的方案。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Phase 0: Intent Message

Reporting Action: Before proceeding, immediately tell the user: "I will upgrade Play Billing Library to the latest version."

Phase 1: Discovery & Situational Awareness

  1. Primary Check (Build Version) : Locate the project's billing dependency (e.g., com.android.billingclient:billing) in build.gradle, build.gradle.kts, or libs.versions.toml.
  2. Initial Compilation Test: Attempt to sync and build the project immediately.
  3. Fallback Discovery (Effective Version) :
    • Trigger: Only if the build fails immediately, scan the source code for deprecated artifacts.
    • Logic : The presence of deprecated APIs indicates the "Effective Version" ---defined as the version where those specific APIs were last available, not when they were introduced.
    • Example : If SkuDetails is present, treat the baseline as PBL v7 or earlier (regardless of the version string in build.gradle).
  4. Identify Target & Path : Access the version tool or release notes to find the latest stable version and calculate a [Direct/Stepped] migration path based on the Effective Version baseline.
  • Calculate Migration Path :
    • If the Effective Version is within 2 major versions of the target: Plan a Direct Migration.
    • If it is more than 2 major versions behind: Plan a Stepped Migration. Migrate by two major versions at a time (e.g., v4 -> v6 -> v8) until you are within two versions of the target.
  • Reporting Action: Before proceeding, tell the user: "I've detected you are effectively on PBL [Current] and the latest is [Target]. I am planning a [direct/stepped] migration path."

Phase 2: Contextual Document Mapping & Planning

For every major version jump identified in your path, you MUST synthesize instructions from:

  • Migration Guide (where [X] is the target major version).
  • Release Highlights : The "Deprecations" and "Breaking Changes" sections of the relevant Release Notes.
  • Developer Documentation: Consult your knowledge of the Google Play Billing documentation regarding the relevant features used in this app (e.g., Subscriptions, One-Time Products).
  • Develop the Plan: Identify every specific code change required (API removals, class replacements, logic shifts) and print this out as a checklist.

Phase 3: Instructions for Execution

Reporting Action: For each of the following steps, give a brief explanation of what you will be doing prior to execution, and a brief summary of what you accomplished afterwards.

Step 1: SDK & Environment Alignment

  • Action : Update build.gradle to meet SDK requirements (e.g., "PBL 9 requires compileSdk 35").
  • Gradle Version: Verify if the new library requires a newer Android Gradle Plugin (AGP) or Kotlin version.

Step 2: Intent-based Refactoring

Analyze the intent of the existing code rather than performing purely textual string replacement.

  • Action : You MUST follow all deprecation instructions and refactor patterns from both the references/migration-logic.md section, the official migration guides, and the general documentation pages identified in Phase 2.
  • Verification : Verify you are doing all steps from all documentation and then making sure you follow the specific directions from the checklist in the references.

Step 3: Sequential Verification (Only applicable for Stepped Migrations)

  1. Upgrade to the first major intermediate version in your path.
  2. Run ./gradlew assembleDebug to verify no intermediate breaking changes were missed.
  3. Repeat until you reach the final target version.

Step 4: Final Validation Checklist

  1. Smart Checklist Verification:
  2. Open references/version-checklist.md and locate the Smart Version-Specific Checklist.
  3. Action: For every version between your [Detected Effective Version] and [Detected New Version], verify that every item has been addressed in the code using "Find in Files" or structural analysis.
  4. Tests : Run all unit and implementation tests (./gradlew test).
  5. Clean Build : Verify the project completes a full clean build: ./gradlew clean assembleDebug. Then, run ./gradlew sync and ./gradlew build s
常见问题

为什么构建文件中的版本号并不总是一致?

已弃用的代码可能表明应用实际上使用的是较旧的版本,因此该技能会使用该代码最后可用的版本。

什么时候会使用分步迁移?

当应用落后于最新稳定版本超过两个主要版本时,该技能会规划分步升级。

它会测试我的购买流程吗?

该技能专注于升级和构建步骤,因此你仍应自行测试购买功能。

详情

作者的原始描述

Use this skill when upgrading or migrating an Android project from any legacy Google Play Billing Library (PBL) version to the latest stable version of PBL.

repo: android/skills

热度

GitHub 星标
10k
排名
#11929
许可证
Apache-2.0
更新时间
2026/10/29

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能