Skip to content Skip to sidebar Skip to footer

Flutter Release Apk:invalid Keystore Format With Linux(deepin)

I try release APK with Flutter,but went wrong: Execution failed for task ':app:packageRelease'. Failed to read key key from store '/home/jerome/key.jks': Invalid keystore format

Solution 1:

I had this issue as well. I'm using android studio.

I unnecessarily installed a java JDK and used that to generate a keytool, which is incorrect because you are supposed to use the one provided from Android Studio.

Steps:

  • flutter doctor -v

  • Should see a Java binary at: under Android toolchain, this is the dir where your keytool is location, mine was /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java

  • Replace java with keytool so in this case /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/keytool

  • Run it directly, in my case I ran /Applications/Android\ Studio.app/Contents/jre/jdk/Contents/Home/bin/keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key

  • Follow prompt

  • The key.jks file will appear in your main dir. Normally somewhere in /Users/<username>/key.jks

  • Now build your android app with this keytool should solve your problem

Solution 2:

It seems that it's really important to generate the keystore with a very particular version of the keytool executable. On my Windows machine, a search for keytool.exe yielded lots of results:

c:\Program Files\Android\Android Studio\jre\bin\keytool.exec:\Program Files\Eclipse Foundation\jdk-8.0.302.8-hotspot\bin\keytool.exec:\Program Files\Eclipse Foundation\jdk-8.0.302.8-hotspot\jre\bin\keytool.exec:\Program Files (x86)\Java\jre1.8.0_301\bin\keytool.exec:\ProgramData\Sony Mobile\Update Engine\{5152617D-088D-4700-97C9-A2696A37E999}\jre\bin\keytool.exec:\Users\All Users\Sony Mobile\Update Engine\{5152617D-088D-4700-97C9-A2696A37E999}\jre\bin\keytool.exe

For my React Native application, I initially created the keystore with c:\Program Files (x86)\Java\jre1.8.0_301\bin\keytool.exe assuming that this would the be most authorative Java installation, and got the "Invalid keystore format" error.

The solution was to go with c:\Program Files\Android\Android Studio\jre\bin\keytool.exe. The rationale behind this would be to use the same Java installation as the build engine (in my case - gradlew bundleRelease).

(Copy pasted my answer from here: How to solve invalid keystore format in android studio?)

Solution 3:

I had this issue as well using VSCode.

Choicodes answer solved the issue, then running % flutter build appbundle --release

Produced the aap required for production in Play store console

Post a Comment for "Flutter Release Apk:invalid Keystore Format With Linux(deepin)"