我完成了windows的react原生设置,完成了以下步骤(并安装了Android Studio),没有遇到任何问题。
choco install nodejs.install
choco install python2
npm install -g react-native-cli然后,我在Android Studio中打开了这个反应原生datetime包的android part。
但是,当我尝试清理和重建时,当它到达react-native compile dependency时,我得到了一个错误
compile 'com.facebook.react:react-native:+'这表明它无法找到已安装的react-native。
完整的错误是:
Error:A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_debugCompile'.
> Could not find any matches for com.facebook.react:react-native:+ as no versions of com.facebook.react:react-native are available.
Searched in the following locations:
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/facebook/react/react-native/maven-metadata.xml
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/facebook/react/react-native/
file:/C:/Users/funkyeah/AppData/Local/Android/sdk/extras/android/m2repository/com/facebook/react/react-native/maven-metadata.xml
file:/C:/Users/funkyeah/AppData/Local/Android/sdk/extras/android/m2repository/com/facebook/react/react-native/
file:/C:/Users/funkyeah/AppData/Local/Android/sdk/extras/google/m2repository/com/facebook/react/react-native/maven-metadata.xml
file:/C:/Users/funkyeah/AppData/Local/Android/sdk/extras/google/m2repository/com/facebook/react/react-native/
Required by:
:android:unspecified我确实注意到包的package.json没有将react-native作为依赖项,或者根本没有任何依赖项……是否所有的react-native包都应该将react-native作为根package.json中的依赖项?
发布于 2016-11-02 14:54:35
我在尝试构建的节点模块中遇到了类似的问题。看起来你需要告诉gradle去哪里找:
repositories {
jcenter()
}
dependencies {
compile 'com.facebook.react:react-native:+'
...
}在存储库内部调用的另一个可能的方法是mavenCentral()。我想jcenter()指向了更新的位置。
发布于 2016-07-27 01:24:59
这里对您的依赖项做了一些小更改,只需替换它即可
compile 'com.facebook.react:react-native:+' To
dependencies {
//...
compile project(":react-native-fbsdk")
}https://stackoverflow.com/questions/38596023
复制相似问题