我正在做一个Expo项目。我已经通过使用安装了@volst/react-native-tuya
yarn add @volst/react-native-tuya
字符串
我使用的是他们的0.3.14版本。我阅读了Here的所有文档,并遵循了所有步骤。
但在我安装并尝试在Android上运行后,我面临的问题是:
配置项目“:@volst_react-native-tuya”时出现问题。无法确定null的依赖项。无法解析配置“:@volst_react-native-tuya:classpath”的所有依赖项。>不支持在没有显式选择加入的情况下对存储库使用不安全的协议。请切换Maven存储库“maven(http://maven.aliyun.com/nexus/content/groups/public/)”以重定向到安全协议(如HTTPS)或允许不安全的协议。有关详细信息,请参阅https://docs.gradle.org/7.3.3/dsl/org.gradle.api.artifacts.repositories.UrlArtifactRepository.html#org.gradle.api.artifacts.repositories.UrlArtifactRepository:allowInsecureProtocol。
x1c 0d1x的数据
我做了所有的努力,但不能解决这个问题。
我的Package.json文件
{
"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"
}
}
型
我的设置.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' }
}
}
型
2条答案
按热度按时间z0qdvdin1#
问题出在软件包本身,因为它调用了问题中提到的url,而没有将allowInsecureProtocol设置为true,当然基于https的url也不可用。你可以用这种方式修复它,这有点黑客,但只要开发人员不推送更新,没有人可以做任何事情。
1.打开
node_modules/@volst/react-native-tuya/android
文件夹,打开build.gradle
文件。1.取代
maven{url 'http://maven.aliyun.com/nexus/content/groups/public/'}
个用这个:
字符串
1.一个额外但推荐的步骤,使用patch-package创建临时修复(https://www.npmjs.com/package/patch-package)
gojuced72#
这是插件的问题。我克隆了这个插件,并通过更新一些代码库来解决这个问题。
如果你也遇到了这个问题,你可以通过在package.json上安装@artalat/react-native-tuya来解决。