npx react-native@latest init AwesomeProject
配置gradle https://blog.csdn.net/weixin_44843569/article/details/120873183
gradle 下载慢 https://blog.csdn.net/liyu_ya/article/details/129403811
项目/android -> gradle -> wrapper -> gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists # distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip distributionUrl=file\:///d:/gradle/gradle-8.8-all.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists
项目/android ->build.gradle
配置好 yarn android 时 下载grade plugin快一些 和 run android debug快一些
buildscript { ext { buildToolsVersion = "34.0.0" minSdkVersion = 23 compileSdkVersion = 34 targetSdkVersion = 34 ndkVersion = "26.1.10909125" kotlinVersion = "1.9.22" } repositories { maven { url 'https://mirrors.cloud.tencent.com/gradle/' } maven{ url 'https://maven.aliyun.com/repository/google'} // maven{ // allowInsecureProtocol true // url "https://maven.aliyun.com/repository/public" // } google() mavenCentral() } dependencies { classpath("com.android.tools.build:gradle") classpath("com.facebook.react:react-native-gradle-plugin") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin") } } allprojects { repositories { maven{ url 'https://maven.aliyun.com/repository/google'} //重点关注这一行 google() jcenter() } } apply plugin: "com.facebook.react.rootproject"
注意对应版本https://docs.gradle.org/current/userguide/compatibility.html
我用的是java17 项目用gradle8.8 环境变量gradle-8.8 react-native@latest=13.6.8
标签:React,react,com,gradle,2024,https,android,maven,Native From: https://www.cnblogs.com/KooTeam/p/18263389