簡體   English   中英

配置項目 ':@volst_react-native-tuya' 時出現問題

[英]A problem occurred configuring project ':@volst_react-native-tuya'

我正在研究Expo項目。 我已經通過使用安裝了@volst/react-native-tuya

yarn add @volst/react-native-tuya

我正在使用他們的0.3.14 版本 我從這里閱讀了所有這些文檔並按照所有步驟操作。

但是在我安裝並嘗試在 android 上運行之后,我遇到了一個問題:

配置項目“:@volst_react-native-tuya”時出現問題。 無法確定 null 的依賴關系。 無法解析配置“:@volst_react-native-tuya:classpath”的所有依賴項。 > 不支持在沒有明確選擇加入的情況下對存儲庫使用不安全的協議。 切換 Maven 存儲庫 'maven( http://maven.aliyun.com/nexus/content/groups/public/ )' 以重定向到安全協議(如 HTTPS)或允許不安全的協議。 See https://docs.gradle.org/7.3.3/dsl/org.gradle.api.artifacts.repositories.UrlArtifactRepository.html#org.gradle.api.artifacts.repositories.UrlArtifactRepository:allowInsecureProtocol for more details.

這就是錯誤

我盡我所能,但無法解決這個問題。

我的 Package.json 文件

{
   "name": "@mevris/client-plugin-installation-components",
   "description": "The Add flow driver",
   "author": "BlueEast Team <code@blueeast.com>",
   "version": "3.0.0-alpha.8",
   "main": "dist/index.js",
   "typings": "dist/index.d.ts",
   "module": "dist/index.js",
   "repository": {
     "type": "git",
     "url": "https://github.com/BlueEastCode/mevris-client-plugin-installation-components"
   },
   "remarkConfig": {
    "plugins": [
       "remark-preset-lint-recommended"
     ]
   },
   "config": {
     "react-native-storybook-loader": {
        "searchDir": [
         "src"
       ],
       "pattern": "**/*.stories.tsx",
       "outputFile": "./storybook/storyLoader.js"
     }
   },
   "scripts": {
     ...
   },
   "dependencies": {
     ...

     "@volst/react-native-tuya": "^0.3.0",
     "expo": "~45.0.0",
     "expo-barcode-scanner": "^11.4.0",
     "expo-location": "~14.2.2",
     "expo-splash-screen": "~0.15.1",
     "expo-status-bar": "~1.3.0",
     "react": "17.0.2",
     "react-dom": "17.0.2",
     "react-native": "0.68.2",
     "react-native-web": "0.17.7",
     "react-native-wifi-reborn": "^4.7.0",
     "yup": "^0.32.11"
   },
   "resolutions": {
     "@types/react": "17.0.2",
     "@types/react-dom": "17.0.2",
     "graphql": "^16.5.0"
   },
   "devDependencies": {
     ...
   },
   "prettier": {
     "singleQuote": true,
     "useTabs": true,
     "trailingComma": "es5"
   },
   "publishConfig": {
     "access": "public"
   },
   "peerDependencies": {
     "yup": "^0.32.11"
   }
 }

我的設置.gradle 文件我的 Settings.gradle 文件 我的 android/build.gradle

import org.apache.tools.ant.taskdefs.condition.Os

 // Top-level build file where you can add configuration options common to all sub-projects/modules.

 buildscript {
     ext {
         buildToolsVersion = findProperty('android.buildToolsVersion') ?: '31.0.0'
         minSdkVersion = Integer.parseInt(findProperty('android.minSdkVersion') ?: '21')
         compileSdkVersion = Integer.parseInt(findProperty('android.compileSdkVersion') ?: '31')
         targetSdkVersion = Integer.parseInt(findProperty('android.targetSdkVersion') ?: '31')
         if (findProperty('android.kotlinVersion')) {
             kotlinVersion = findProperty('android.kotlinVersion')
         }
         frescoVersion = findProperty('expo.frescoVersion') ?: '2.5.0'

         if (System.properties['os.arch'] == 'aarch64') {
             // For M1 Users we need to use the NDK 24 which added support for aarch64
             ndkVersion = '24.0.8215888'
         } else {
             // Otherwise we default to the side-by-side NDK version from AGP.
             ndkVersion = '21.4.7075529'
         }
     }
     repositories {
         google()
         mavenCentral()
     }
     dependencies {
         classpath('com.android.tools.build:gradle:7.0.4')
         classpath('com.facebook.react:react-native-gradle-plugin')
         classpath('de.undercouch:gradle-download-task:4.1.2')
         // NOTE: Do not place your application dependencies here; they belong
              // in the individual module build.gradle files
     }
 }

 allprojects {
     repositories {
         mavenLocal()
         maven {
             // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
             url(new File(['node', '--print', "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), '../android'))
         }
         maven {
             // Android JSC is installed from npm
             url(new File(['node', '--print', "require.resolve('jsc-android/package.json')"].execute(null, rootDir).text.trim(), '../dist'))
         }

         google()
         maven { url "https://maven.google.com" }
                 jcenter() {
                     allowInsecureProtocol = true
                 }
         mavenCentral {
             // We don't want to fetch react-native from Maven Central as there are
             // older versions over there.
             content {
                 excludeGroup 'com.facebook.react'
             }
         }
         maven { url 'https://www.jitpack.io' }
     }
 }

嘗試寫這個而不是

maven { url "https://maven.google.com" }
             jcenter() {
                 allowInsecureProtocol = true
             }

這個

repositories {
    maven {
        url "url"
        allowInsecureProtocol = true
    }
    // other repositories ...
}

The issue is with the package itself, since it calls the url mentioned in the issue without setting allowInsecureProtocol to true, and of course https based url is not available. 您可以通過這種方式修復它,這有點駭人聽聞,但只要開發人員不推送更新,就沒有人可以做任何事情。

  1. Go package 文件夾node_modules/@volst/react-native-tuya/android並打開build.gradle文件。

  2. 代替

    maven{url 'http://maven.aliyun.com/nexus/content/groups/public/'}

有了這個:

maven {
      url 'http://maven.aliyun.com/nexus/content/groups/public/'
      allowInsecureProtocol = true
}
  1. 一個額外但推薦的步驟,使用 patch-package 創建臨時修復( https://www.npmjs.com/package/patch-package

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM