title: Flutter Failed to read key upload from store "key.jks". Invalid keystore format
body: <p>I am trying to generate <code>appbundle</code> using <code>flutter build appbundle --release</code>, when i run the command it throws following errors.</p>
  <pre><code>
  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;/android/app/key.jks&quot;: Invalid keystore format
  </code></pre>
  <p>For signing the app, I followed the <a href="https://docs.flutter.dev/deployment/android" rel="nofollow noreferrer">Flutter Official Documentation for Android</a></p>
  <p>my <code>app/build.gradle</code></p>
  <pre><code>def keystoreProperties = new Properties()
  def keystorePropertiesFile = rootProject.file('key.properties')
  if (keystorePropertiesFile.exists()) {
      keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
  }
  
  android {
      compileSdkVersion flutter.compileSdkVersion
  
      compileOptions {
          sourceCompatibility JavaVersion.VERSION_1_8
          targetCompatibility JavaVersion.VERSION_1_8
      }
  
      kotlinOptions {
          jvmTarget = '1.8'
      }
  
      sourceSets {
          main.java.srcDirs += 'src/main/kotlin'
      }
  
      defaultConfig {
          // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
          applicationId &quot;com.batuwacab&quot;
          minSdkVersion 20
          targetSdkVersion flutter.targetSdkVersion
          versionCode flutterVersionCode.toInteger()
          versionName flutterVersionName
          multiDexEnabled true
      }
  
         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><a href="https://i.stack.imgur.com/ADy9d.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ADy9d.png" alt="Flutter Doctor" /></a></p>
  <p>I have stored <code>key.jks</code> in <code>android/app</code> and used this command to generate <code>key.jks</code>
  <code>keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias upload</code></p>
  <p>Thanks in Advance.</p>