首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >安装iap本机-iap后,iap本机应用程序无法运行

安装iap本机-iap后,iap本机应用程序无法运行
EN

Stack Overflow用户
提问于 2022-02-25 22:52:51
回答 1查看 451关注 0票数 3

我有一个其他工作的反应-本地应用程序,但需要包括在应用程序内的购买,以使它被接受在应用商店。在Googling上搜索了一小会儿之后,它看起来就像是一种本能的反应-iap几乎是唯一的选择。

第一误差

在遵循安装步骤这里之后,我在Android中得到以下错误:

e: C:_path_to_my_project_\node_modules\react-native-iap\android\src\play\java\com\dooboolab\RNIap\RNIapModule.kt:(215,37):类型错配:推断类型是字符串?但是String被认为是

正如链接中所述,错误将抛出在RNIapModule.kt文件中,我将从下面链接一个摘录(完整的代码将我推过字符限制,但自安装以来我没有更改它)。

我从指令中撤消了所有更改,似乎唯一阻止我获得此错误的是没有在android/app/build.gradle中添加存储规范,当然,在前面提到的错误之前,也出现了错误。

二次误差

在构建部分的高处,我看到了另一个错误:

代码语言:javascript
复制
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-iap:compilePlayDebugKotlin'.

> Compilation error. See log for more details

错误日志:An unexpected packet was received before the handshake.

RN和IAP版本

React原生版本: 0.63.4

iap本机-iap版本:^8.0.5

完全依赖列表

代码语言:javascript
复制
  "dependencies": {
    "@react-native-async-storage/async-storage": "^1.13.2",
    "@react-native-community/checkbox": "^0.5.7",
    "@react-native-community/masked-view": "^0.1.11",
    "@react-native-community/netinfo": "^6.0.0",
    "@react-native-community/progress-bar-android": "^1.0.4",
    "@react-native-community/progress-view": "^1.2.3",
    "@reduxjs/toolkit": "^1.4.0",
    "@thecodingmachine/redux-toolkit-wrapper": "1.3.0",
    "axios": "^0.21.1",
    "buffer": "^6.0.3",
    "date-fns": "^2.19.0",
    "es6-symbol": "^3.1.3",
    "flipper-plugin-react-native-inspect-json-client": "^0.1.2",
    "formik": "^2.1.4",
    "i18next": "^19.8.2",
    "lottie-ios": "3.1.8",
    "lottie-react-native": "4.0.2",
    "moment": "^2.29.1",
    "prop-types": "^15.7.2",
    "ramda": "^0.27.1",
    "react": "16.13.1",
    "react-i18next": "^11.7.3",
    "react-native": "0.63.4",
    "react-native-app-intro-slider": "^3.0.0",
    "react-native-appearance": "^0.3.4",
    "react-native-chart-kit": "^6.10.1",
    "react-native-charts-wrapper": "^0.5.7",
    "react-native-copilot": "^2.5.0",
    "react-native-dotenv": "^0.2.0",
    "react-native-flipper": "^0.130.0",
    "react-native-gesture-handler": "^1.10.3",
    "react-native-iap": "^8.0.5",
    "react-native-image-crop-picker": "^0.35.3",
    "react-native-image-picker": "^3.1.4",
    "react-native-iphone-x-helper": "^1.3.1",
    "react-native-map-link": "^2.7.25",
    "react-native-material-menu": "^1.2.0",
    "react-native-modal": "^11.7.0",
    "react-native-permissions": "^3.2.0",
    "react-native-picker-select": "^6 P.5.0",
    "react-native-progress": "^5.0.0",
    "react-native-prompt-android": "^1.1.0",
    "react-native-reanimated": "^2.3.0",
    "react-native-safe-area-context": "^3.2.0",
    "react-native-screens": "^3.3.0",
    "react-native-size-matters": "^0.3.0",
    "react-native-sqlite-storage": "^5.0.0",
    "react-native-svg": "^12.1.0",
    "react-native-template-": "thecodingmachine/react-native-boilerplate",
    "react-native-toast-message": "^1.4.9",
    "react-native-video": "^5.1.1",
    "react-navigation": "^3.11.2",
    "react-redux": "^7.2.1",
    "redux": "^4.0.5",
    "redux-flipper": "^1.4.2",
    "redux-logger": "^3.0.6",
    "redux-persist": "^6.0.0",
    "redux-saga": "^1.0.2",
    "reduxsauce": "^1.0.1",
    "utf8": "^3.0.0",
    "yup": "^0.28.1"
  },
  "devDependencies": {
    "@babel/core": "^7.8.4",
    "@babel/plugin-proposal-decorators": "^7.13.5",
    "@babel/runtime": "^7.8.4",
    "@react-native-community/eslint-config": "^1.1.0",
    "babel-jest": "^25.1.0",
    "babel-plugin-ignite-ignore-reactotron": "^0.3.0",
    "eslint": "^6.5.1",
    "eslint-config-prettier": "^4.1.0",
    "eslint-config-standard": "^12.0.0",
    "eslint-plugin-import": "^2.16.0",
    "eslint-plugin-node": "^8.0.1",
    "eslint-plugin-prettier": "^3.0.1",
    "eslint-plugin-promise": "^4.0.1",
    "eslint-plugin-react": "^7.12.4",
    "eslint-plugin-react-native": "^3.6.0",
    "eslint-plugin-standard": "^4.0.0",
    "jest": "^25.1.0",
    "metro-react-native-babel-preset": "^0.59.0",
    "prettier": "^1.16.4",
    "react-native-rename": "^2.4.1",
    "react-test-renderer": "16.13.1",
    "reactotron-react-native": "^4.0.2",
    "reactotron-redux": "^3.1.2",
    "reactotron-redux-saga": "^4.2.3",
    "seamless-immutable": "^7.1.4",
    "seamless-immutable-mergers": "^7.1.0"
  },

RNIapModule.kt代码

只是抛出错误的函数块:

代码语言:javascript
复制
...
   @ReactMethod
    fun getItemsByType(type: String?, skuArr: ReadableArray, promise: Promise) {
        ensureConnection(
            promise,
            object : EnsureConnectionCallback {
                override fun run(billingClient: BillingClient) {
                    val skuList = ArrayList<String>()
                    for (i in 0 until skuArr.size()) {
                        skuList.add(skuArr.getString(i))
                    }
...
EN

回答 1

Stack Overflow用户

发布于 2022-04-08 01:24:20

skuList.add(skuArr.getString(i).orEmpty())

请尝试添加.orEmpty()

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71272535

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档