javaandroidreact-nativeexpojava-11

How to fix jlink does not exist?


i am working with react native and am trying to use expo in a bare project but whenever i try to run the app with the command npm run android, i get this error :

Execution failed for task ':expo-modules-core:compileDebugJavaWithJavac'.
> Could not resolve all files for configuration ':expo-modules-core:androidJdkImage'.
   > Failed to transform core-for-system-modules.jar to match attributes {artifactType=_internal_android_jdk_image, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
      > Execution failed for JdkImageTransform: /home/dukizwe/Android/Sdk/platforms/android-31/core-for-system-modules.jar.
         > jlink executable /usr/lib/jvm/java-14-openjdk-amd64/bin/jlink does not exist.

I am using the linux OS, Android studio and JDK are correctly installed.

Inside /usr/lib/jvm/ folder, the structure look like this:

i don't know why it's looking in the java-14-openjdk-amd64 folder because in that folder there's no jlink executable.

In android studio the SDK Location si pointed to java-11-openjdk. Any help please ?


Solution

  • I also faced same issue when I did run my React Native app on my new Ubuntu 22.x machine. I fixed it with installing JRE along with JDK.

    Step 1 sudo apt install default-jre followed by java -version

    should display -

    Output openjdk version "11.0.14" 2022-01-18 OpenJDK Runtime Environment (build 11.0.14+9-Ubuntu-0ubuntu2) OpenJDK 64-Bit Server VM (build 11.0.14+9-Ubuntu-0ubuntu2, mixed mode, sharing)

    Followed by - sudo apt install default-jdk

    Check - javac -version to get output as -

    Output javac 11.0.14

    Hope it helps!