title: Mac OS Flutter build appbundle failed: Invalid keystore format
body: <p>since a week I am trying to create android app bundle from a flutter app and I've followed from <a href="https://flutter.dev/docs/deployment/android" rel="nofollow noreferrer">Create an upload keystore</a> given official flutter website</p>
  <p>in Mac OS I've tried following command in terminal</p>
  <pre><code>keytool -genkey -v -keystore ~/upload-keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias upload
  </code></pre>
  <p>it prompted me to Enter keystore passwordand which I've write <code>android</code> and then Re-enter new password:<code>android</code>
  after that sequence of questions and answers which I've filled up like as your first and last name?, What is the name of your organizational unit?, What is the name of your organization?, What is the name of your City or Locality?, What is the name of your State or Province?, What is the two-letter country code for this unit?, and finally asked about the information is correct which I replied yes, it made .jks file while prompting like this</p>
  <pre><code>Generating 2,048 bit RSA key pair and self-signed certificate (SHA256withRSA) with a validity of 10,000 days
      for: CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown
  [Storing /Users/faizfareed/upload-keystore.jks]
  </code></pre>
  <p>after that I've Created a file named <code>[project]/android/key.properties</code> that containing a reference to the keystore with following info in the file</p>
  <pre><code>storePassword=android
  keyPassword=android
  keyAlias=upload
  storeFile=/Users/faizfareed/upload-keystore.jks
  </code></pre>
  <p>finally I've Configured gradle <code>[project]/android/app/build.gradle</code> file.</p>
  <p>Added the keystore information from properties file before the <code>android</code> block:</p>
  <pre><code>   def keystoreProperties = new Properties()
     def keystorePropertiesFile = rootProject.file('key.properties')
     if (keystorePropertiesFile.exists()) {
         keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
     }
  
     android {
           ...
     }
  </code></pre>
  <p>Loaded the <code>key.properties</code> file into the <code>keystoreProperties</code> object.</p>
  <p>Replaced the <code>buildTypes</code> block:</p>
  <pre><code>buildTypes {
         release {
             // TODO: Add your own signing config for the release build.
             // Signing with the debug keys for now,
             // so `flutter run --release` works.
             signingConfig signingConfigs.debug
         }
     }
  </code></pre>
  <p>With the signing configuration info:</p>
  <pre><code>signingConfigs {
         release {
             keyAlias keystoreProperties['keyAlias']
             keyPassword keystoreProperties['keyPassword']
             storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
             storePassword keystoreProperties['storePassword']
         }
     }
     buildTypes {
         release {
             signingConfig signingConfigs.release
         }
     }
  </code></pre>
  <p>finally when I executed <code>flutter build appbundle</code> command, it giving error like this one</p>
  <pre><code>faizfareed@Faizs-MBP building_apk % flutter build appbundle 
  
  Building without sound null safety
  For more information see https://dart.dev/null-safety/unsound-null-safety
  
                                                                          
  FAILURE: Build failed with an exception.                                
                                                                          
  * What went wrong:                                                      
  Execution failed for task ':app:signReleaseBundle'.                     
  &gt; A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
     &gt; Failed to read key upload from store &quot;/Users/faizfareed/upload-keystore.jks&quot;: Invalid keystore format
                                                                          
  * Try:                                                                  
  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
                                                                          
  * Get more help at https://help.gradle.org                              
                                                                          
  BUILD FAILED in 7s                                                      
  Running Gradle task 'bundleRelease'...                                  
  Running Gradle task 'bundleRelease'... Done                         7.8s
  Gradle task bundleRelease failed with exit code 1
  </code></pre>
  <p>for reference I am also attaching Image of the terminal</p>
  <p><a href="https://i.stack.imgur.com/fC6UC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fC6UC.png" alt="enter image description here" /></a></p>
  <p>I've also tried following <a href="https://stackoverflow.com/questions/20453249/apk-signing-error-failed-to-read-key-from-keystore">solution</a> but nothing works for me</p>
  <p>Can anyone help me out from this error <strong>Invalid keystore formate</strong></p>