Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No Java runtime present, requesting install : Mac OS, Flutter

Tags:

flutter

I am trying to generate keystore file using following command.

keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key

But getting following error.

No Java runtime present, requesting install.

I develop app using flutter and create APK for android, I am following below link https://flutter.io/android-release/

I don't know how to resolve this. So please help me.

like image 865
Kishan Vyas Avatar asked Aug 19 '18 05:08

Kishan Vyas


People also ask

Why does my Mac say unable to locate Java Runtime?

The message “Unable to load Java Runtime Environment” means that the Mac computer cannot load JRE, either because it is out of date or (more usually) because it has not yet been downloaded and installed. It can also happen after the computer OS X has been updated, e.g. to 10.14 Mojave from 10.13 Maverick.

How do I know if Java is installed on my Mac?

Mac OS X 10.7. 3 and above: Under System Preferences click on the Java icon to access the Java Control Panel which will list your Java version. If you do not see a Java icon under System Preferences, Java 7 or later versions is not installed.


2 Answers

/Applications/Android\ Studio.app/Contents/jre/jdk/Contents/Home/bin/keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key

Running this command should be okay. Just tested with the latest MacOS.

Note: make sure you have installed Android Studio

like image 133
atereshkov Avatar answered Oct 20 '22 00:10

atereshkov


You have to install Java (Runtime) in your system as Android requires the same.

Follow below steps given in the links and try to run again.

https://java.com/en/download/help/mac_install.xml

When you are generating Flutter to Android apk. What is actually happening is your code is getting converted to android code and android requires java so that's why it's complaining for java.

I hope this helps.

like image 40
Shivang Agarwal Avatar answered Oct 19 '22 23:10

Shivang Agarwal