You are not logged in.

#1 2023-08-09 17:25:30

JaydenDev
Member
Registered: 2022-07-11
Posts: 172

Can't build React Native program, JDK issues.

Here's the output of react native:

BUILD FAILED in 2s

Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
e: No class roots are found in the JDK path: /usr/lib/jvm/java-8-openjdk/jre

FAILURE: Build failed with an exception

that's the output of

ANDROID_HOME=/opt/android-sdk npm run start

then pressing A to run on Android.

I used this AUR package to obtain the SDK: https://aur.archlinux.org/packages/android-sdk

Here's the output of

archlinux-java status
Available Java environments:
  java-17-openjdk
  java-20-openjdk
  java-8-openjdk (default)

If you are wondering why I'm using Java 8 instead of something like Java 17 or Java 20. That's because if I try to use anything newer than Java 8, the entire SDK toolchain falls apart.

Here's the output of

ls /usr/lib/jvm/java-8-openjdk/jre

as that's the directory the error mentions

bin  lib

Here's the contents of the bin and lib dirs:

lib:

amd64                 cmm                       hijrah-config-umalqura.properties  jfr.jar             management-agent.jar  resources.jar
applet                content-types.properties  images                             jsse.jar            meta-index            rt.jar
calendars.properties  currency.data             jce.jar                            jvm.hprof.txt       net.properties        security
charsets.jar          ext                       jexec                              logging.properties  psfontj2d.properties  sound.properties
classlist             flavormap.properties      jfr                                management          psfont.properties.ja  tzdb.dat

bin:

java  jjs  keytool  orbd  pack200  policytool  rmid  rmiregistry  servertool  tnameserv  unpack200

System Specs:
Intel Core i5-2400 Nvidia GTX 1050ti Logitech G402 Hyperion Fury (Mouse) BestBuy Essentials USB Keyboard
Software Specifications:
Desktop Environment: KDE Plasma Window Manager: KWin Operating System: Arch Linux (btw)

Offline

#2 2023-08-10 17:00:54

twelveeighty
Member
From: Alberta, Canada
Registered: 2011-09-04
Posts: 1,096

Re: Can't build React Native program, JDK issues.

The "No class roots are found" error typically happens when Kotlin is involved, but in case that's not required, do you have jdk8-openjdk installed, or just jre8-openjdk? The former brings in the latter but you likely will have to have the JDK installed, not just the JRE.

If that's already the case, try also adding openjdk8-src, which adds src.zip. Also make sure to clear your gradle cache, you should expect the JDK path to be picked up as "/usr/lib/jvm/java-8-openjdk", not "/usr/lib/jvm/java-8-openjdk/jre".

Offline

#3 2023-08-10 17:04:12

JaydenDev
Member
Registered: 2022-07-11
Posts: 172

Re: Can't build React Native program, JDK issues.

twelveeighty wrote:

The "No class roots are found" error typically happens when Kotlin is involved, but in case that's not required, do you have jdk8-openjdk installed, or just jre8-openjdk? The former brings in the latter but you likely will have to have the JDK installed, not just the JRE.

If that's already the case, try also adding openjdk8-src, which adds src.zip. Also make sure to clear your gradle cache, you should expect the JDK path to be picked up as "/usr/lib/jvm/java-8-openjdk", not "/usr/lib/jvm/java-8-openjdk/jre".

Both jdk8-openjdk and jre8-openjdk are installed. Do I extract src.zip somewhere?


System Specs:
Intel Core i5-2400 Nvidia GTX 1050ti Logitech G402 Hyperion Fury (Mouse) BestBuy Essentials USB Keyboard
Software Specifications:
Desktop Environment: KDE Plasma Window Manager: KWin Operating System: Arch Linux (btw)

Offline

#4 2023-08-10 17:13:25

twelveeighty
Member
From: Alberta, Canada
Registered: 2011-09-04
Posts: 1,096

Re: Can't build React Native program, JDK issues.

I highly doubt you need to extract the zip. After the installation of openjdk8-src and clearing your gradle cache, does the error still point to the JDK path being "/usr/lib/jvm/java-8-openjdk/jre"? If anything, it should be looking in "/usr/lib/jvm/java-8-openjdk" instead. You may have to actually set JAVA_HOME to force it to look there, otherwise.

Offline

#5 2023-08-10 17:20:09

JaydenDev
Member
Registered: 2022-07-11
Posts: 172

Re: Can't build React Native program, JDK issues.

twelveeighty wrote:

I highly doubt you need to extract the zip. After the installation of openjdk8-src and clearing your gradle cache, does the error still point to the JDK path being "/usr/lib/jvm/java-8-openjdk/jre"? If anything, it should be looking in "/usr/lib/jvm/java-8-openjdk" instead. You may have to actually set JAVA_HOME to force it to look there, otherwise.

Installing openjdk8-src changes the error. Apparently Java 11 or later is required but this is problematic because as I said earlier, the tools (sdk manager in this case) fall apart when running with any more than java 8. Setting java home to 17 causes an error that the license agreements have to be accepted, however it runs sdkmanager to check this but it fails because java 11.

* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
     platforms;android-33 Android SDK Platform 33
     build-tools;30.0.3 Android SDK Build-Tools 30.0.3
  To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
  All licenses can be accepted using the sdkmanager command line tool:
  sdkmanager.bat --licenses
  Or, to transfer the license agreements from one workstation to another, see https://developer.android.com/studio/intro/update.html#download-with-gradle
  
  Using Android SDK: /opt/android-sdk

System Specs:
Intel Core i5-2400 Nvidia GTX 1050ti Logitech G402 Hyperion Fury (Mouse) BestBuy Essentials USB Keyboard
Software Specifications:
Desktop Environment: KDE Plasma Window Manager: KWin Operating System: Arch Linux (btw)

Offline

#6 2023-08-10 17:31:48

twelveeighty
Member
From: Alberta, Canada
Registered: 2011-09-04
Posts: 1,096

Re: Can't build React Native program, JDK issues.

That error you posted doesn't indicate anything about Java 11? Can you post the error you get that makes you think you require Java 11?

Offline

#7 2023-08-10 18:21:14

JaydenDev
Member
Registered: 2022-07-11
Posts: 172

Re: Can't build React Native program, JDK issues.

twelveeighty wrote:

That error you posted doesn't indicate anything about Java 11? Can you post the error you get that makes you think you require Java 11?

The error I posted was after I switched to Java 11+.


System Specs:
Intel Core i5-2400 Nvidia GTX 1050ti Logitech G402 Hyperion Fury (Mouse) BestBuy Essentials USB Keyboard
Software Specifications:
Desktop Environment: KDE Plasma Window Manager: KWin Operating System: Arch Linux (btw)

Offline

Board footer

Powered by FluxBB