No Java runtime present, requesting install : Mac OS, Flutter - 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.

/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

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.

Related

gradlew signingreport missing keystore while getting sha 1 for release mode flutter apk

I was testing release mode of my app and the firebase auth is not working, so i google it and find out that i have to register SHA1 for release mode, and to get it we need keysotre file which i generated using command:
keytool -genkey -v -keystore release.keystore -alias AndroidReleaseKey -keyalg RSA -keysize 2048 -validity 10000
i was taking help of this documentaion: Click here
and THIS STACKOVERFLOW QUESTION
but now when i run ./gradlew signingreport i am getting this
i want the SHA1 key for release mode can anyone help me through it and also my android studio is not working fine so give me answers that doesn't require it.
Check Your Path c\file , And upgrade Project --flutter Upgrade or Update , After Retry.
I got it. The only mistake is that I put \ in store file path and when I use / instead it worked as I wanted.

Missing keystore in Flutter

I want to get the SHA-1 code, but I encountered an error.
C:\Users\erdem\AndroidStudioProjects\flutter_app\android>gradlew
signinReport
Missing Keystore
how can I solve this problem?
I was trying to get the SHA1 but I couldn't get because of the missing keystore error, I tried that and it worked for me I don't know if it really works.
If you have your own jks file and did lead it with key.properties but still gives the error Missing Keystore that worked for me :
Type keytool -alias "AndroidDebugKey" -genkeypair in the terminal of your android studio give it a password of android.
The rest of the fields or questions asked after that don't matter so just press Enter.
Go to your home directory (C:\Users) and look for a file named as .keystore.
Rename .keystore to debug.keystore.
Now copy and paste it to (C:\Users.android).
Re-run the signReport task to generate a new key for APP.
source: https://stackoverflow.com/a/63064024/7767761
Had the same issue. Cleanest fix I found is to generate a debug key:
keytool -genkey -v -keystore ~/.android/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"
gradlew signinReport will work after that.
Source
You can follow these steps:
Create a file named /android/key.properties that contains a reference to your keystore:
storePassword=<password from previous step>
keyPassword=<password from previous step>
keyAlias=key
storeFile=<location of the key store file, such as /Users/<user name>/key.jks>
I had the same problem.
This error comes when dubug.keystore file is missing in users/"Name"/.android/ directory and can be resolved by simply run your app on any mobile device it will create the debug.keystore file in the directory now the error should be gone on running signingreport.
cheers..!

Upload failed in play store

I am unable to upload app into play store using ionic v1.... error is "Your uploaded apk or Android app bundle with invalid or missing signing info. you need to create a validly signed apk or Android app bundle.
Check your Keystore file and again generate your APK using valid keystore
GUIDE TO PUBLISH YOUR APPLICATION:
Step 1).
keytool -genkey -v -keystore “my-release-key.keystore “ –alias “alias_name” -keyalg RSA -keysize 2048 -validity 10000
· my-release-key.keystore: path to keystore
· example: D:\projects\path\to\your\project\KeystoreName.keystore
· “alias_name” : Name of your project
Step 2).
ionic cordova build --release android
Step 3).
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore D:\project\path\to\your\project/keystoreName.keystore D:\projects\path\to\your\project\platforms\android\app\build\outputs\apk\debug\app-debug.apk alias_name
Step 4). inside your sdk buildtool folder
zipalign -v 4 D:\projects\path\to\your\project\platforms\android\app\build\outputs\apk\debug\app-debug.apk D:\projects\path\to\your\project\platforms\android\app\build\outputs\apk\debug\Zipalign.apk

Ionic 3 updated APK publishing failed

After uploading updated APK to play store I see this error message:
enter image description here
You are trying to upload unsigned apk to play store so you are getting this error.
Please create a singed apk with your keystore or jks then upload to play tore.
Publishing Apk
Step 1. Create Keystore (keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000)
Step 2. build apk (ionic cordova build android --prod --release)
Step 3. jarsign the unsigned apk using the keystore (jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore YOU_KEYSTORE.keystore android-release-unsigned.apk YOUR_APK_NAME)
Step 4. Zipalign the unsigned apk ( /home/USER_NAME/Android/Sdk/build-tools/25.0.2/zipalign -v 4 android-release-unsigned.apk YOUR_APK_NAME.apk )
try to add a file under platforms/android called release-signing.properties. Than fill out the data. With this the apk will be signed during every build.
storeFile=../../keystore/yourkeystore.keystore
storeType=jks
keyAlias=yourAlias
keyPassword=yourPassword
storePassword=yourStorePassword
If it's still not working than you signed the apk in the play store with a different key.
If you want to update your app then you need to sign your application with keytool you used for the initial release using that only you can update your application. Please sign the unsigned apk using the previous keytool and try to upload that apk in playstore.
Thanks for your support. problem is solved now. I deleted both .jks file and release-signing.properties from dir and created unsigned apk again.
I suppose the problem is signing two times APK.

If keytool command was successful, do we need to do jarsigner as well?

I created a Cordova app called myApp with CLI, then immediately ran this:
keytool -genkey -v -keystore myApp.keystore -alias myApp -keyalg RSA -keysize 2048 -validity 10000
I put the keystore and apk files in the same folder. When I attempted to sign it with jarsigner with:
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore myApp.keystore myApp.apk myApp
... I got the output:
jarsigner: unable to sign jar: java.util.zip.ZipException: invalid entry compressed size (expected 814 but got 818 bytes)
When I do:
jarsigner -verify -verbose -certs myApp.apk
...the output ended with:
jar verified.
This means the apk has already been signed. During the process, a "2,048 bit RSA key pair and self-signed certificate (SHA1withRSA) with a validity of 10,000 days" is created. Does that mean the present myApp.apk does not need a separate jarsigner process applied, and it is ready for Play store as is (assuming it meets all Google Play rules)?
I've been confused about the jarsigner portion of this whole process, and come to a crashing stop each time I use it. (By "jarsigner portion" I mean implementing jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore myApp.keystore myApp.apk myApp after the keytool code.)
My development environment:
Mac OS X 10.9.5 on latest Mac Mini
Cordova CLI 3.6.3 (cordova, not phonegap)
Not for PG Build; no Jquery or other JS or CSS packages used
I am not using Eclipse; I am deliberately learning how to build a signed apk without it.
Problem stems from the fact that there is a bug in the 3.6.3 version in that release code hasn't been thoroughly documented and implemented. Filed a bug report on Jira.
I assume you are following these instructions. When building your apk did you compile in release mode so that it will generate an unsigned apk? Seeing as how you are unable to sign using jarsigner, but verify that it is signed already, I feel the problem may lie with your apk.