Issue
Hello community I get the following error when executing the command.
npx react-native run-android --verbose
This is my version of react-native and its information.
System:
OS: Linux 5.15 Ubuntu 20.04.5 LTS (Focal Fossa)
CPU: (4) x64 Intel(R) Core(TM) i3-7100U CPU @ 2.40GHz
Memory: 2.72 GB / 15.50 GB
Shell: 5.8 - /usr/bin/zsh
Binaries:
Node: 14.19.1 - ~/.nvm/versions/node/v14.19.1/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v14.19.1/bin/yarn
npm: 6.14.16 - ~/.nvm/versions/node/v14.19.1/bin/npm
Watchman: Not Found
SDKs:
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Languages:
Java: 11.0.16 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.68.3 => 0.68.3
npmGlobalPackages:
*react-native*: Not Found
I know it seems strange, but SDK bugs should be dismissed, because it recognizes the emulator and other SDK features. Or if for some the error is here, then tell me how to solve this and I will do it.
I already made the Java 11 security configurations, according to this documentation => https://docs.oracle.com/en/java/javase/11/security/java-cryptography-architecture-jca-reference-guide.html#GUID-EFA5AC2D-644E-4CD9-8523-C6D3936D5FB1
And several days ago I dragged this problem, and I can't find any kind of solution. If someone ever came across this, your help would be very valuable, since I have been changing configurations and methods for several days.
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1355 file(s) to forward-jetify. Using 4 workers...
info JS server already running.
* daemon not running; starting now at tcp:5037
* daemon started successfully
info Launching emulator...
error Failed to launch emulator. Reason: Could not start emulator within 30 seconds..
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...
Exception in thread "main" java.lang.RuntimeException: Could not hash input string.
at org.gradle.wrapper.PathAssembler.getHash(PathAssembler.java:69)
at org.gradle.wrapper.PathAssembler.rootDirName(PathAssembler.java:48)
at org.gradle.wrapper.PathAssembler.getDistribution(PathAssembler.java:41)
at org.gradle.wrapper.Install.createDist(Install.java:44)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:63)
Caused by: java.security.NoSuchAlgorithmException: MD5 MessageDigest not available
at java.base/sun.security.jca.GetInstance.getInstance(GetInstance.java:159)
at java.base/java.security.Security.getImpl(Security.java:700)
at java.base/java.security.MessageDigest.getInstance(MessageDigest.java:178)
at org.gradle.wrapper.PathAssembler.getHash(PathAssembler.java:64)
... 5 more
One last clarification, if I compile from android studio, the application compiles. Thank you all!
Solution
I have discovered the problem that brought me so many headaches. It turns out that when installing Java 11 from sudo apt install openJdk11-1.0.16-amd64
, for security when installing it that way, the securtiy updates are not installed.
How did I solve it?
downloading from https://www.oracle.com/java/technologies/downloads/#java11
downloaded file:
jdk-11.0.16.1_linux-aarch64_bin.tar.gz
Obviously for Linux system.
Downloaded this file, I moved it to the folder where my Java 11 was installed (/usr/lib/jvm) through the console with tar I made the installation. (Follow the guide in the previous link).
jdk11-11.0.16.1 is installed and we navigate inside that folder and we go to /conf/security
inside this folder we have another folder that is policy and java.policy file and java.security file that our security configurations are inside, compare your old installation of JAVA 11 and notice that files are the ones that are missing, just copy the security of the new installation and paste them in the old installation (in my case it was java-1.11.0-openjdk-amd64) the paths are obviously the same, since it is an installation similar, made from different points. Once I pasted that security folder (or the files that are necessary, check each case) my MD5 errors disappeared, as well as the CRYPTOGRAPHY MECHANISMS errors and other errors such as sun.class.SSL.security
, etc.
I recommend read this article some order folders inside JDK11 and their configuration.
I hope it helps!
Answered By - Guido Gagliardini
Answer Checked By - Gilberto Lyons (JavaFixing Admin)