You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 8b1b579
Browse filesBrowse the repository at this point in the historyBrowse files
[in_app_purchase_android] Update to Play Billing Library 9.1.0 (#12781)
Updates `com.android.billingclient:billing` from 8.0.0 to 9.1.0 in `in_app_purchase_android`.
**Why the minSdk change is required.** Play Billing Library 9 declares `minSdkVersion 23` in its own AAR manifest (8.0.0 declared 21). With the plugin still on `minSdk = 21`, the manifest merger fails in any consuming app:
```
Manifest merger failed : uses-sdk:minSdkVersion 21 cannot be smaller than
version 23 declared in library [com.android.billingclient:billing:9.1.0]
```
The library module itself still builds at 21, so this only surfaces in the app that consumes the plugin. Raising the plugin's `minSdk` to 23 makes the constraint explicit. Flutter's own `flutter.minSdkVersion` is already 24, so there is no practical impact on clients. The same floor is imposed a second time transitively, via `play-services-basement` 18.9.0.
**No removed APIs are used.** Diffing the public API of `billing-8.0.0.aar` against `billing-9.1.0.aar` shows v9 removes exactly seven classes — `SkuDetails`, `SkuDetailsParams(.Builder)`, `SkuDetailsResponseListener`, `BillingClient.SkuType`, `QueryPurchaseHistoryParams(.Builder)` — plus `BillingFlowParams.Builder.setSkuDetailsList`. None appear anywhere under `android/src`. `PurchaseHistoryRecord`, which `Translator.kt` still imports, survives into 9.1.0.
**Deprecation.** `SubscriptionUpdateParams.Builder.setSubscriptionReplacementMode` is deprecated as of 8.1.0 but remains functional in 9.x. Because the example builds the plugin with `-Xlint:all -Werror`, this breaks the build, so it is suppressed with an explanatory comment rather than migrated. Migrating to `SubscriptionProductReplacementParams` is not a drop-in change: it renumbered the replacement mode constants, which would alter the values carried by the Dart `ReplacementMode` enum. That belongs in its own breaking change.
**Behaviour change reaching clients.** Under v9, a Play Store blocked by the system (for example OEM-customized kids mode) reports `BILLING_UNAVAILABLE` instead of `ERROR`. The plugin maps response codes 1:1 and branches on neither value, so no plugin code changes; but apps that branch on the code, or match on the stringified code in `IAPError.message`, are affected. This is called out in the CHANGELOG.
Also corrects the documentation for `BillingResponse.billingUnavailable` (described the legacy "billing API version not supported" meaning) and `BillingResponse.serviceUnavailable` (described a network outage, which is what `networkError` means).
This supersedes #12414, the Dependabot version-only bump, which does not include the required `minSdk` change and therefore does not build.
## Testing
Automated: all existing Dart and native unit tests pass against 9.1.0, and the example app builds.
Manual, against a real Play Console app running this branch with billing 9.1.0:
- product queries (`queryProductDetails`) return the expected products, prices and offers
- restoring past purchases works
Not exercised manually: the subscription replacement path (`setSubscriptionReplacementMode`), which is the deprecated call suppressed in this PR, and consumable purchase/consumption. Flagging that explicitly since it is the least-covered part of this change — note also that the plugin's unit tests mock `BillingClient` entirely, so none of them exercise the real library at runtime.
Fixesflutter/flutter#189974
## Pre-Review Checklist
**Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.
**Test exemption:** this is a manual dependency roll, which Tree Hygiene lists as *not* automatically exempt, so I am requesting one explicitly. The plugin's behaviour is unchanged: response codes are passed through 1:1 (`Translator.kt` -> pigeon -> `pigeon_converters.dart`), and no branch in the plugin keys on `error` or `billingUnavailable`. The one user-visible change originates in Google's library, not in plugin code, and so cannot be exercised by a plugin test. Happy to add tests if a reviewer sees a seam I have missed.
**On the deprecation suppression:** if the team would rather take the breaking `SubscriptionProductReplacementParams` migration now instead of suppressing, I am glad to do that here or in a follow-up — say which you prefer.
[^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
Copy file name to clipboardExpand all lines: packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/MethodCallHandlerImpl.java
+7Lines changed: 7 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -282,6 +282,13 @@ public void queryProductDetailsAsync(
282
282
}
283
283
}
284
284
285
+
// SubscriptionUpdateParams.Builder.setSubscriptionReplacementMode is deprecated as of Google
286
+
// Play Billing Library 8.1.0 in favour of SubscriptionProductReplacementParams, but remains
287
+
// functional in 9.x. Migrating is not a drop-in change: the replacement mode constants were
288
+
// renumbered, so it would alter the values carried by the Dart ReplacementMode enum.
289
+
// TODO(gmackall): migrate to setSubscriptionProductReplacementParams as a
290
+
// separate breaking change. https://github.com/flutter/flutter/issues/194324
Copy file name to clipboardExpand all lines: packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/billing_client_wrapper.dart
+11-2Lines changed: 11 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -380,10 +380,19 @@ enum BillingResponse {
380
380
/// The user pressed back or canceled a dialog.
381
381
userCanceled,
382
382
383
-
/// The network connection is down.
383
+
/// The service is currently unavailable.
384
+
///
385
+
/// This is a transient state; the request can be retried later. Note that
386
+
/// Play no longer returns [BillingResponse.serviceTimeout], and timeouts are
387
+
/// reported here instead.
384
388
serviceUnavailable,
385
389
386
-
/// The billing API version is not supported for the type requested.
390
+
/// A user billing error occurred during processing.
391
+
///
392
+
/// As of Google Play Billing Library 9, this is also returned when the Play
393
+
/// Store app is blocked by the system (for example, in OEM-customized kids
394
+
/// mode), a case that previously surfaced as [BillingResponse.error]. Such
395
+
/// results carry a `Play Store is blocked` debug message.
387
396
billingUnavailable,
388
397
389
398
/// The requested product is not available for purchase.
0 commit comments