Ubuntu, can't start reacting-native: could not find tools.jar

I followed the guide to getting started with Android / Linux.

I am trying to start a native reaction under Ubuntu using react-native run-android, but it fails with an error:

FAILURE: Build failed with an exception.

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

How can i fix this?

Full conclusion:

 $ react-native run-android
    Starting JS server...
    /bin/sh: 1: adb: not found
    Building and installing the app on the device (cd android && ./gradlew 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:prepareComAndroidSupportSupportV42321Library UP-TO-DATE
    :app:prepareComFacebookFrescoDrawee0110Library UP-TO-DATE
    :app:prepareComFacebookFrescoFbcore0110Library UP-TO-DATE
    :app:prepareComFacebookFrescoFresco0110Library UP-TO-DATE
    :app:prepareComFacebookFrescoImagepipeline0110Library UP-TO-DATE
    :app:prepareComFacebookFrescoImagepipelineBase0110Library UP-TO-DATE
    :app:prepareComFacebookFrescoImagepipelineOkhttp30110Library UP-TO-DATE
    :app:prepareComFacebookReactReactNative0361Library UP-TO-DATE
    :app:prepareComFacebookSoloaderSoloader010Library 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

Launch echo $JAVA_HOMEgives/usr/lib/jvm/java-8-openjdk-amd64

+8
source share
4 answers

Solved it by installing openjdk again:

sudo apt-get install openjdk-8-jdk
+36
source

Criminal!

Make sure the Java compiler is available. I usually don’t develop Java, so even though Java works there, I never specifically compiled a Java project. Run:

javac -version

, , ... . Oracle JDK (), . , :

unset $JAVA_HOME
source ~/.profile

: .profile script SDK env vars.

, !

+2

If you come here from Google and work for RHEL, you need to

sudo yum install java-1.8.0-openjdk-javadoc

and

sudo yum install java-1.8.0-openjdk-devel
+2
source

In ubuntu

sudo apt-get install openjdk-8-jdk-headless
0
source

Source: https://habr.com/ru/post/1659921/


All Articles