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

443 views Asked by At

I am working on an Expo Project. I have installed @volst/react-native-tuya by using

yarn add @volst/react-native-tuya

and I'm using their 0.3.14 Version. I read all this documentation from Here and follow all steps.

But after I install and try to run on android I'm Facing an issue which is:

A problem occurred configuring project ':@volst_react-native-tuya'. Could not determine the dependencies of null. Could not resolve all dependencies for configuration ':@volst_react-native-tuya:classpath'. > Using insecure protocols with repositories, without explicit opt-in, is unsupported. Switch Maven repository 'maven(http://maven.aliyun.com/nexus/content/groups/public/)' to redirect to a secure protocol (like HTTPS) or allow insecure protocols. 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.

That's the error

I do all my efforts but can't resolve this.

My Package.json File

{
   "name": "@mevris/client-plugin-installation-components",
   "description": "The Add flow driver",
   "author": "BlueEast Team <[email protected]>",
   "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"
   }
 }

My Settings.gradle File My Settings.gradle File My 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' }
     }
 }
2

There are 2 answers

4
dev404 On BEST ANSWER

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. You can fix it this way, it is kinda hacky but as long as the dev doesn't push an update, none can do anything afaik.

  1. Go the package folder node_modules/@volst/react-native-tuya/android and open build.gradle file.

  2. Replace

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

with this:

maven {
      url 'http://maven.aliyun.com/nexus/content/groups/public/'
      allowInsecureProtocol = true
}
  1. An extra but recommended step, use patch-package to create a temporary fix (https://www.npmjs.com/package/patch-package)
0
Talha On

It was the issue of the plugin. I clone this plugin and resolve this by updating some code base.

If you were also facing this issue you can resolve this by installing @artalat/react-native-tuya on your package.json.