尝试运行react-native run-android
时,版本无法找到链接的软件包。
已经尝试更新软件包,所有内容均在最新版本上。
package.json:
"@react-native-community/async-storage": "1.5.0",
"@react-native-community/netinfo": "3.2.1",
"lodash": "4.17.11",
"react": "16.8.6",
"react-native": "0.59.10",
"react-native-actionsheet": "2.4.2",
"react-native-device-info": "2.1.3",
"react-native-gesture-handler": "1.3.0",
"react-native-image-crop-picker": "0.24.1",
"react-native-masked-text": "1.12.3",
"react-native-progress-bar-animated": "1.0.6",
"react-native-youtube": "1.1.0",
"react-navigation": "3.11.0",
"react-redux": "7.1.0",
"redux": "4.0.1",
"redux-persist": "5.10.0",
"redux-saga": "1.0.4"
在CLI上:
package com.facebook.react.module.annotations does not exist: import com.facebook.react.module.annotations.ReactModule
在Android Studio上:
Not a supported repository protocol 'C': valid protocols are [file, http, https, gcs, s3, sftp]
答案 0 :(得分:1)
通常在您的构建无法找到您的node_modules
文件夹时发生。
尝试检查您的android/build.gradle
文件是否存在固定路径,例如:
allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "C:/dev/myapp/node_modules/react-native/android"
}
maven { url "https://jitpack.io" }
}
}
在url "C:/dev/myapp/node_modules/react-native/android"
行中查看。
您可能需要将固定路径更改为其相对版本:
url "$rootDir/../node_modules/react-native/android"
这应该有助于构建找到正确的路径。 ?