Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

app:compileDebugJavaWithJavac FAILED

Tags:

react-native

I successfully setup react native to create new app in android on windows. But I stuck in this below mentioned error when I tried to run app in emulator. Can anyone help me to solved this issue? Thanks in Advance...

>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
like image 818
R.evolvan Avatar asked Mar 23 '16 12:03

R.evolvan


2 Answers

I ran into the same problem. You need to set JAVA_HOME environment variable. To do that:

  1. Open your terminal by pressing Ctrl+Alt+T.
  2. Enter the following command: $ subl /etc/environment.
  3. Depending on where you installed your Java, you will need to provide the full path. For this example, I installed JDK 1.7 in the /usr/lib/jvm/jdk1.7.0_79 directory. Scroll to the end of the file and enter the following:

    JAVA_HOME="/usr/lib/jvm/jdk1.7.0_79" export JAVA_HOME

  4. Save your file and exit sublime.
  5. Lastly, reload the system PATH with the following command: $ . /etc/environment.

This should fix your issue.

like image 67
Manraj Singh Avatar answered Oct 31 '22 21:10

Manraj Singh


If you are working with react native, just make sure you set up environment variables correctly for java compiler. after this goto package.json file in your project:

change this:

"react-native": "https://github.com/expo/react-native/archive/sdk-31.0.0.tar.gz",

to: "react-native": "0.57.5",

save and run npm install

Source: https://github.com/facebook/react-native/issues/21722

like image 29
Archit Pandey Avatar answered Oct 31 '22 23:10

Archit Pandey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!