React Native 上的应用内计费问题

Issues with In-app-billing on React Native

我正在使用它在我的 React Native 项目上实施应用内计费。 https://github.com/idehub/react-native-billing

这是我正在使用的代码。

InAppBilling.open()
.then(() => InAppBilling.purchase('android.test.purchased'))
.then((details) => {
  console.log("You purchased: ", details)
  return InAppBilling.close()
});

我收到了这个错误。

谁能帮我解决这个问题?提前致谢。

这来自 GitHub issue:

"Easiest way is to run react-native link react-native-billing after npm install --save react-native-billing. That will add the native build config for you. The link command will be adding the native config, and you do not have to follow the manual installation.

But your build.gradle should not contain com.anjlab.android.iab.v3 since that is added by this module in another file. Yours should instead have something like compile project(':react-native-billing')."

进行这样的更改后,我总是在终端中 运行 重置所有内容,然后刷新应用程序:

watchman watch-del-all

node_modules/react-native/packager/packager.sh --reset-cache

您是否尝试在安装库后卸载并安装应用程序? 如果你只是用节点文件重新加载应用程序将不起作用。您需要卸载并重新安装该应用程序才能在您的应用程序中获取 Inappbilling。

我唯一成功的一次是重新弹出应用程序,重建节点模块和 pods,并在最后用 react-native link 链接所有库。