第一次运行到安卓失败
Could not find implementation class 'com.facebook.react.ReactRootProjectPlugin' for plugin 'com.facebook.react.rootproject' specified in jar:file:/D:/Android_Studio_Data/.gradle/caches/jars-9/o_3a1fd35320f05989063e7069031b710f/react-native-gradle-plugin.jar!/META-INF/gradle-plugins/com.facebook.react.rootproject.properties.
修改android下的build.gradle
buildscript {
ext {
buildToolsVersion = "34.0.0"
minSdkVersion = 21
compileSdkVersion = 34
targetSdkVersion = 34
ndkVersion = "25.1.8937393"
kotlinVersion = "1.8.0"
}
repositories {
maven{ url 'https://maven.aliyun.com/repository/google'}
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"
打开app,满屏红色,状态500
关闭这个,重新运行
如果还不行
npm uninstall babel-preset-react-native
npm install babel-preset-react-native@2.1.0 —save
或
yarn remove babel-preset-react-native
yarn add babel-preset-react-native@2.1.0