[英]React Native - android wont compile after adding react-native-firebase
My react native android was compiling fine until I added react-native-firebase as per the docs (ios compiles fine).我的 react native android 编译良好,直到我根据文档添加 react-native-firebase (ios 编译良好)。
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin
java JRE v8.202 /Library/Internet Plug-Ins/JavaAppletPlugin.plugin
/Library/Java/JavaVirtualMachines
java JRE v8.202 /Library/Java/JavaVirtualMachines
/Applications/AndroidStudio.app/Contents/jre/jd/Contents/Home
请注意,JAVA_HOME 路径设置为/Applications/AndroidStudio.app/Contents/jre/jd/Contents/Home
Error:错误:
> Task :react-native-firebase_app:compileDebugJavaWithJavac FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-firebase_app:compileDebugJavaWithJavac'.
> Could not find tools.jar. Please check that /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home contains a valid JDK installation.
I'm using Mac Bigsur beta 4, and I have the same problem.我正在使用 Mac Bigsur beta 4,我也遇到了同样的问题。
I tried uninstalling java by following the steps in this link:我尝试按照此链接中的步骤卸载 java:
https://www.java.com/en/download/help/mac_uninstall_java.xmlhttps://www.java.com/en/download/help/mac_uninstall_java.xml
After that I checked the java version in terminal using: java -version
.之后,我使用以下命令检查了终端中的 java 版本: java -version
。 The uninstall process didn't work.卸载过程不起作用。 However, running react-native run-android
now works.但是,运行react-native run-android
现在可以工作了。
Try this.尝试这个。 It may work for you.它可能对你有用。
Note: If you tried uninstalling java, and running react-native run-android
still doesn't work, add this to bash_profile and try again: export JAVA_HOME=/Applications/AndroidStudio.app/Contents/jre/jdk/Contents/Home
注意:如果您尝试卸载 java,并运行react-native run-android
仍然不起作用,请将其添加到 bash_profile 并重试: export JAVA_HOME=/Applications/AndroidStudio.app/Contents/jre/jdk/Contents/Home
Ran source ~/.bash_profile
to ensure JAVA_HOME path set to /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home
and it compiled, yay. Ran source ~/.bash_profile
以确保将 JAVA_HOME 路径设置为/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home
并编译,是的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.