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:
- java-1.11.0-openjdk-amd64
- java-1.14.0-openjdk-amd64
- java-11-openjdk-amd64
- java-14-openjdk-amd64
- jdk-18
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 ?
4
Answers
I’ve just copied
jlink
,javac
andjmod
from this path:/home/USER/android-studio/jre/bin/
to the following path:
/usr/lib/jvm/java-11-openjdk-11.0.15.0.10-1.fc36.x86_64/bin
Note: It’s important to use
Terminal
as rootOS Used: Linux Fedora 36
You need to install the development package for Java. On debian, this is the
openjdk-11-jdk
package.For IntelliJ IDEA, go to:
File > Project Structure
and inProject
tab changeSDK
to any SDK that uses JDK 11 or 8.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 byjava -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!