question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

keytool is unable to find the Java runtime

See original GitHub issue

@andreban @d-koppenhagen

I was giving BubbleWrap a try by running commands from this page https://web.dev/using-a-pwa-in-your-android-app/#bubblewrap npx @bubblewrap/cli init --manifest=https://pwa-directory.appspot.com/manifest.json

Then, I realized I needed to set up JDK. To do that, I followed the steps on https://github.com/GoogleChromeLabs/bubblewrap/tree/master/packages/cli

  1. Download a version of JDK 8 that is compatible with your OS from AdoptOpenJDK and extract it in its own folder. https://adoptopenjdk.net/releases.html?variant=openjdk8&jvmVariant=hotspot

I downloaded OpenJDK 8

  1. I downloaded CLI tools https://developer.android.com/studio#command-tools

After unzipping, I have these folders Screen Shot 2020-07-14 at 5 41 00 PM Screen Shot 2020-07-14 at 5 47 18 PM

I have these in my llama-pack-config.json

{ 
  "jdkPath":"/Users/jun/Downloads/jdk8u252-b09",                 
  "androidSdkPath":"/Users/jun/Downloads/tools"
}   

When I ran npx @bubblewrap/cli init --manifest=https://pwa-directory.appspot.com/manifest.json, I got this error.

Screen Shot 2020-07-14 at 5 50 30 PM

Error message:

cli ERROR Command failed: keytool -genkeypair -dname "cn=JD, ou=Eng, o=C, c=CA" -alias "./android.keystore" -keypass "123456" -keystore "./android.keystore" -storepass "123456" -validity 20000 -keyalg RSA
No Java runtime present, requesting install.

folder access

-rw-r--r--@  1 jun  staff    96M 14 Jul 17:19 OpenJDK8U-jdk_x64_mac_hotspot_8u252b09.tar.gz
-rw-r--r--@  1 jun  staff    83M 14 Jul 17:19 commandlinetools-mac-6609375_latest.zip
drwxr-xr-x@  3 jun  staff    96B 22 Apr 01:54 jdk8u252-b09
drwxr-xr-x@  6 jun  staff   192B 14 Jul 17:21 tools

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
andrebancommented, Jul 15, 2020

After running the command, I noticed that ./twa-manifest.json is saved in the current directory instead of the directory I specified --directory=‘./pwa-android’

This is a bug. The file should have been created at ./pwa-android

I encountered this error earlier and it can be fixed by changing my androidSdkPath to /Users/jun/Downloads instead of /Users/jun/Downloads/tools

Unfortunately, unzip the Android command-line tools from the UI ends up unzipping it to the current folder, because the zip file only contains the /tools folder. But, as you noticed, the SDK downloads more files and adds them to the same folder level as tools. So, I’d recommend unzipping the files to an android-sdk folder and pointing to that.

licence, build-tools, platform-tools, etc are part of the Android command-line tools (and it’s that tool that creates them), not the Android project. They are indeed created in the “right” place.

You may be interested in the flow here: https://www.youtube.com/watch?v=QJlbMfW3jPc

1reaction
andrebancommented, Jul 15, 2020

Updated README.md

Read more comments on GitHub >

github_iconTop Results From Across the Web

Even though JRE 8 is installed on my MAC -" No Java ...
For example, when I do apt update I get the error The operation couldn't be completed. Unable to locate a Java Runtime that...
Read more >
How to solve “Unable to locate a Java Runtime that supports ...
Try to run caver_analyst with the --jdkhome switch, followed by (I guess) the path to a valid JDK as suggested in your error...
Read more >
Java Runtime not found | Apple Developer Forums
Today it can't find Java. Research says to check the Java icon in the System Preferences. But there is no Java icon in...
Read more >
'keytool' is not recognized as an internal or external command
This step-by-step guide shows how to install keytool and add it to your system PATH on Windows and macOS.
Read more >
[Solved] Error: Could not find Java SE Runtime Environment
1. Go to "Programs and Features" and uninstall all the previous java versions. Check the location "C:/Program Files/..." and delete ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found