Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-13684

Not be able to sign apk with 6.4.0 and 7.0.0 without specifying passwords in build.json

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • cordova-android
    • None

    Description

      Since 6.4.0, sign APK without specify passwords in config file does not work.

      Cause gradle 4.1.0 has this issue 2826 - Use SwingBuilder in customize task on Android studio throw java.awt.HeadlessException. (link).

      If you don't specify passwords in config file to sign your APK, compilation launches a window with SwingBuilder to prompt passwords.

      def doPromptForPassword(msg) {
          if (System.console() == null) {
              def ret = null
              new SwingBuilder().edt {
                  dialog(modal: true, title: 'Enter password', alwaysOnTop: true, resizable: false, locationRelativeTo: null, pack: true, show: true) {
                      vbox {
                          label(text: msg)
                          def input = passwordField()
                          button(defaultButton: true, text: 'OK', actionPerformed: {
                              ret = input.password;
                              dispose();
                          })
                      }
                  }
              }
              if (!ret) {
                  throw new GradleException('User canceled build')
              }
              return new String(ret)
          } else {
              return System.console().readPassword('\n' + msg);
          }
      }
      

      On Linux Mint 18.3 and MacOs High sierra, even in terminal, System.console() return null and compilation crashes due to gradle issue.

      Thanks for help.

      Attachments

        Issue Links

          Activity

            People

              bowserj Joey Robert Bowser
              kevin-lot Kevin Lot
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated: