Flutter release APK:Invalid keystore format with Linux(deepin)

1,163

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

Share:
1,163
Sheng Gao
Author by

Sheng Gao

Updated on November 18, 2022

Comments

  • Sheng Gao
    Sheng Gao about 1 month

    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

    My storePassword and keyPassword is right.enter image description here

  • Hossein Abedi
    Hossein Abedi 11 months
    Same for React Native. I used: $JAVA_HOME/jre/bin/keytool