# Play Billing Library Version Upgrade

Use this skill when upgrading or migrating an Android project from any legacy Google...

- Repository: https://github.com/android/skills (10219 stars)
- Category: Mobile
- License: Complete terms in LICENSE.txt
- Last updated: 2026-10-29
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add android/skills --skill play-billing-library-version-upgrade -g -a claude-code -y`
Codex: `npx skills add android/skills --skill play-billing-library-version-upgrade -g -a codex -y`
Cursor: `npx skills add android/skills --skill play-billing-library-version-upgrade -g -a cursor -y`
Gemini CLI: `npx skills add android/skills --skill play-billing-library-version-upgrade -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add android/skills`

## Description

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.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

## 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:

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