我有一个React Native应用程序,可以在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: 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_HOME
的终端上正常给我的SDK路径,我跟着作出反应本土广告再开始看,如果我错过了什么,但似乎一切都正确安装。
我不知道为什么这将无法运行。
在您android\app\build.gradle
尝试添加
android {
...
defaultConfig {
...
multiDexEnabled true
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句