【发布时间】:2021-12-09 15:00:51
【问题描述】:
(在 Android 上)在我的代码中,当我想开始获取产品 ID 时,代码永远不会超过这一行:
final bool isAvailable = await InAppPurchase.instance.isAvailable();
有时它会随机执行该行并在此处停止:
try {
ProductDetailsResponse productDetailResponse = await InAppPurchase.instance.queryProductDetails(_productIds.toSet());
//...
} on PlatformException catch (platformException) {
print(platformException);
} catch (error) {
print(error);
}
我将这两行都放入了 try-catch 错误中,但没有错误也没有异常。我现在一头雾水。
我正在使用in_app_purchase: ^2.0.0 和Flutter 2.5.3 stable channel
如果您有任何提示,我将不胜感激。
附注在 iOS 上一切正常
【问题讨论】:
-
@AwiasRehman 不是这样,它不执行该行,这就是问题所在。
-
我最近遇到了一个类似问题的开发人员,这是由于在他们的 build.gradle 文件中包含 android 支付库引起的。
-
@developerextraordinare 你是什么意思?我把文档说的
implementation "com.android.billingclient:billing-ktx:$billing_version" -
Note: It is not necessary to depend on com.android.billingclient:billing in your own app's android/app/build.gradle file. If you choose to do so know that conflicts might occur.取自pub.dev/packages/in_app_purchase
标签: flutter