[in_app_purchase] Clarify billing dependency handling for Android in example README#11089
[in_app_purchase] Clarify billing dependency handling for Android in example README#11089khosbilegt wants to merge 4 commits intoflutter:mainfrom
Conversation
Add important note about common pitfall in dependency management for Google Play Billing.
There was a problem hiding this comment.
Code Review
This pull request clarifies the Android billing dependency setup in the example's README to prevent users from manually adding a conflicting dependency, which is a valuable addition. The corresponding changelog entry has a minor typo and could be more concise. I've provided a suggestion to address this.
|
Had to debug this for a couple hours and found the fix at https://stackoverflow.com/a/70589769/19938854. LLMs couldn't figure it out. Thought adding it to the README, having it up on pub.dev and having it get indexed would be useful for others. |
Accepted Gemini's suggestion for CHANGELOG Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
bparrishMines
left a comment
There was a problem hiding this comment.
LGTM
Although it's typically implied that plugins handle native dependencies because the purpose of the plugin is to provide access to the native library, I'm not opposed to adding additional documentation if multiple people may be running into this issue as shown by the stackoverflow issue.
@stuartmorgan-g for secondary review
I don't think the vote counts on the SO issue suggest that this is a widespread problem, but I think the argument there that the setup docs that plugin clients need to follow include the gradle step is a reasonable one for adding some kind of note. |
stuartmorgan-g
left a comment
There was a problem hiding this comment.
I think this can all be collapsed to a short bullet point under step 4 (which is about the same file):
- Unless you are also calling Google Play Billing directly from your app's native code, you do not need to add the
com.android.billingclientdependency to your gradle file. If you do have a direct dependency, make sure that you are using the same version asin_app_purchaseis using internally.
|
|
||
| > **NOTE:** The dependency snippet shown in the Google Play Billing Overview setup guide: | ||
| > ``` | ||
| > implementation "com.android.billingclient:billing:$billing_version" |
There was a problem hiding this comment.
We should not show code that people should not add; an unfortunate number of people will copy and paste things without reading the context carefully, so including this line could increase issues.
| > ``` | ||
| > implementation "com.android.billingclient:billing:$billing_version" | ||
| > ``` | ||
| > should not be manually added when using this plugin. The plugin already manages the billing client |
There was a problem hiding this comment.
should not be manually added when using this plugin
This isn't fully accurate; if an application uses the billing client directly for any reason, it should be managing its dependency.
| > implementation "com.android.billingclient:billing:$billing_version" | ||
| > ``` | ||
| > should not be manually added when using this plugin. The plugin already manages the billing client | ||
| > dependency internally, and adding it manually may cause build conflicts or prevent the app from |
There was a problem hiding this comment.
"may" is pretty vague here; the actual problem would arise from using an incompatible version.
|
|
||
| ### Android | ||
|
|
||
| > **NOTE:** The dependency snippet shown in the Google Play Billing Overview setup guide: |
There was a problem hiding this comment.
Google Play Billing Overview setup guide
It's not clear to me what exactly this is referencing; neither the page nor the section with the code below is called this, but its capitalized like it's a page title.
Clarify misleading billing setup instructions in the Android example for in_app_purchase's README.md (or rather lack of clarification).
Following the instructions of Google Play Billing documentation setup and adding the dependency in
build.gradlecauses Play Store connectivity issues, and must not be added.Pre-Review Checklist
[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or I have commented below to indicate which version change exemption this PR falls under1.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style, or I have commented below to indicate which CHANGELOG exemption this PR falls under1.///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot 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.Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2 ↩3