React native 安装问题
这周打算玩下React native , 真是看着官方教程简单,安装起来各种问题,属于是把坑踩完了,
完全不知道这玩意儿这么累,几次都想放弃了,
这里记录一下自己的采坑
1.安装用最新版的,要配置JDK11
2.安装源速度慢,那就必须得切换,不然就速度非常慢
在你的C盘 C:\Users\34300\.gradle 创建一个文件 init.gradle,配置了之后下载就很快了,可是第一次也没跑起来,第二次才跑起来
allprojects{
repositories {
def ALIYUN_REPOSITORY_URL = 'https://maven.aliyun.com/repository/central/'
def ALIYUN_JCENTER_URL = 'https://maven.aliyun.com/repository/public/'
all { ArtifactRepository repo ->
if(repo instanceof MavenArtifactRepository){
def url = repo.url.toString()
if (url.startsWith('https://repo1.maven.org/maven2') || url.startsWith('http://repo1.maven.org/maven2')) {
project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_REPOSITORY_URL."
remove repo
}
if (url.startsWith('https://jcenter.bintray.com/') || url.startsWith('http://jcenter.bintray.com/')) {
project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_JCENTER_URL."
remove repo
}
}
}
maven {
url ALIYUN_REPOSITORY_URL
url ALIYUN_JCENTER_URL
url 'https://maven.aliyun.com/repository/google/'
url 'https://maven.aliyun.com/repository/gradle-plugin/'
}
}
buildscript{
repositories {
def ALIYUN_REPOSITORY_URL = 'https://maven.aliyun.com/repository/central/'
def ALIYUN_JCENTER_URL = 'https://maven.aliyun.com/repository/public/'
all { ArtifactRepository repo ->
if(repo instanceof MavenArtifactRepository){
def url = repo.url.toString()
if (url.startsWith('https://repo1.maven.org/maven2') || url.startsWith('http://repo1.maven.org/maven2')) {
project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_REPOSITORY_URL."
remove repo
}
if (url.startsWith('https://jcenter.bintray.com/') || url.startsWith('http://jcenter.bintray.com/')) {
project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_JCENTER_URL."
remove repo
}
}
}
maven {
url ALIYUN_REPOSITORY_URL
url ALIYUN_JCENTER_URL
url 'https://maven.aliyun.com/repository/google/'
url 'https://maven.aliyun.com/repository/gradle-plugin/'
}
}
}
}
3.安装模拟器会占用C盘,C盘尽量腾出地方来,我记得是大于7G
反正是一番折腾

浙公网安备 33010602011771号