简体   繁体   English

React Native - 添加 react-native-firebase 后 android 不会编译

[英]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 编译良好)。

  • React Native 0.63.2 and react-native-firebase 8.3.0 latest versions and followed docs very carefully. React Native 0.63.2 和 react-native-firebase 8.3.0 最新版本并非常仔细地遵循文档。 OSX 10.15.6 OSX 10.15.6
  • Deleted/cleared/reinstalled gradle and android gradle/build dirs etc.删除/清除/重新安装 gradle 和 android gradle/build dirs 等。
  • java JRE v8.202 /Library/Internet Plug-Ins/JavaAppletPlugin.plugin java JRE v8.202 /Library/Internet Plug-Ins/JavaAppletPlugin.plugin
  • java JRE v8.202 /Library/Java/JavaVirtualMachines java JRE v8.202 /Library/Java/JavaVirtualMachines
  • Note that JAVA_HOME path set to /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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM