做一个记录,解决androidstudio无法下载最新的React Native问题
在你的 android/app/build.gradle添加代码
compile 'com.facebook.react:react-native:<your_version_here>'
然后在android/build.gradle文件里面添加
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
//********这里必须写对应的目录,否则找不到本地node_modules下面的包
url "$rootDir/../node_modules/react-native/android"
}
}
configurations.all {
resolutionStrategy {
eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'com.facebook.react' && details.requested.name == 'react-native') {
details.useVersion "<your_version_here>"
}
}
}
}
}