2
Cordova 8.1.1 (cordova-lib@8.1.0)
Android 7.1.1
OSX 10.13.6

The following Cordova release build command errors out. What are we doing wrong?

$ cordova build --release android

BUILD FAILED in 5s
46 actionable tasks: 2 executed, 44 up-to-date
/Users/xxx/QS/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:packageRelease'.
> Failed to generate v1 signature


build.json

  {
    "android": {
      "release": {
        "keystore": "/Users/xxx/QS/platforms/android/appreleasedemo.keystore",
        "storePassword": "password",
        "alias": "appreleasedemoalias",
        "password" : "password"
      }
    }
  }

The keystore is present:

$ keytool -keystore /Users/xxx/QS/platforms/android/appreleasedemo.keystore -list

Keystore type: jks
Keystore provider: SUN

Your keystore contains 1 entry

appreleasedemoalias, Oct 1, 2018, PrivateKeyEntry, 
Certificate fingerprint (SHA1): FC:63:EC:88:0A:A2:ED:B4:7A:34:C1:76:F9:98:F5:E0:8D:85:7A:4F
Lightbeard
  • 4,011
  • 10
  • 49
  • 59
  • Possible duplicate of [Android Studio: Error:org.gradle.tooling.BuildException: Failed to generate v1 signature](https://stackoverflow.com/questions/48248406/android-studio-errororg-gradle-tooling-buildexception-failed-to-generate-v1-s) – elshev Apr 19 '19 at 09:42

1 Answers1

11

I found I was able to fix this issue by using the following command line to build a new key file, as desribed at https://developer.android.com/studio/publish/app-signing.html:

keytool -genkey -v -keystore my-release-key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias my-alias

Specifically, I believe the problem is that the default has changed from RSA to DSA at some point, and the tools don't work correctly with large DSA keys.

Helen Valeria
  • 174
  • 1
  • 4