gpt4 book ai didi

react-native - 应用程序 :compileDebugJavaWithJavac FAILED

转载 作者:行者123 更新时间:2023-12-03 13:27:16 25 4
gpt4 key购买 nike

我成功地设置了 react native 在 Windows 上的 android 中创建新应用程序。但是当我尝试在模拟器中运行应用程序时,我陷入了下面提到的错误。谁能帮我解决这个问题?
提前致谢...

>react-native run-android

'which' is not recognized as an internal or external command,
operable program or batch file.
Starting JS server...
Starting the packager in a new window is not supported on Windows yet.
Please start it manually using 'react-native start'.
We believe the best Windows support will come from a community of people
using React Native on Windows on a daily basis.
Would you be up for sending a pull request?
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72301Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42301Library UP-TO-DATE
:app:prepareComFacebookFrescoDrawee081Library UP-TO-DATE
:app:prepareComFacebookFrescoFbcore081Library UP-TO-DATE
:app:prepareComFacebookFrescoFresco081Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipeline081Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipelineOkhttp081Library UP-TO-DATE
:app:prepareComFacebookReactReactNative0222Library UP-TO-DATE
:app:prepareOrgWebkitAndroidJscR174650Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:bundleDebugJsAndAssets SKIPPED
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
**:app:compileDebugJavaWithJavac FAILED**

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Could not find tools.jar

最佳答案

我遇到了同样的问题。您需要设置JAVA_HOME环境变量。要做到这一点:

  • 按 Ctrl+Alt+T 打开终端。
  • 输入以下命令:$ subl /etc/environment .
  • 根据您安装 Java 的位置,您需要提供完整路径。在这个例子中,我安装了 JDK 1.7/usr/lib/jvm/jdk1.7.0_79目录。滚动到文件末尾并输入以下内容:
    JAVA_HOME="/usr/lib/jvm/jdk1.7.0_79"
    export JAVA_HOME
  • 保存您的文件并退出 sublime。
  • 最后,使用以下命令重新加载系统路径:$ . /etc/environment .

  • 这应该可以解决您的问题。

    关于react-native - 应用程序 :compileDebugJavaWithJavac FAILED,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36178595/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com