React Native won';我不认识Android SDK
我有一个React本机应用程序,在iOS上运行良好,我也尝试在Android上运行它,但总是出现错误:React Native won';我不认识Android SDK,android,react-native,Android,React Native,我有一个React本机应用程序,在iOS上运行良好,我也尝试在Android上运行它,但总是出现错误: error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details. Error: C
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
D8: Cannot fit requested classes in a single dex file (# methods: 116691 > 65536 ; # fields: 80012 > 65536)
我尝试了我所看到的每一个解决方案,但没有任何效果
我运行了react native community cli doctor
,似乎react native无法识别Android SDK。
我检查过了,emulator sdk
和gradle sdk
版本是相同的。
在终端上呼应ANDROID\u HOME
正确地给出了sdk路径,我按照React Native getting started再次查看是否遗漏了一些内容,但似乎所有内容都安装正确
我不明白为什么这不会运行。在您的
android\app\build.gradle中尝试添加
android {
...
defaultConfig {
...
multiDexEnabled true
}
}
你有没有测试过“hello world”应用程序的健康检查?关于类大小的抱怨意味着它似乎在试图运行。@DaveNewton是的,我的应用程序在iOS上运行得很好,在Android上我无法运行。我还试着运行原生Android应用程序,检查是否所有东西都安装正确,运行原生应用程序没有问题。