[ https://issues.apache.org/jira/browse/CB-13684?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16298315#comment-16298315 ]
Daniel Cooper edited comment on CB-13684 at 12/20/17 11:42 AM: --------------------------------------------------------------- I managed to recreate the issue with the weather-app in a container. Hopefully the dockerfile below helps. I've inserted the line into the build.gradle file, and that's still not fixed this issue. {code} FROM python:2.7-stretch RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - RUN apt-get install -y nodejs build-essential unzip default-jdk gradle WORKDIR /usr/src/android-sdk ENV sdk_file=sdk-tools-linux-3859397.zip RUN wget https://dl.google.com/android/repository/$sdk_file && unzip $sdk_file RUN yes | tools/bin/sdkmanager --licenses RUN tools/bin/sdkmanager "build-tools;27.0.2" "platforms;android-26" ENV ANDROID_HOME=/usr/src/android-sdk/ RUN npm install -g cordova WORKDIR /usr/src RUN git clone https://github.com/Microsoft/cordova-samples.git WORKDIR /usr/src/cordova-samples/weather-app/WeatherApp RUN cordova platform add android #Generate a key RUN keytool -genkey -noprompt \ -alias alias1 \ -dname "CN=test.com, OU=ID, O=foo, L=foo, S=foo, C=GB" \ -keystore keystore \ -storepass password \ -keypass password #Insert the supposed fix in the build.gradle file. RUN sed -i 's|all sub-projects/modules.|all sub-projects/modules.\nSystem.setProperty("java.awt.headless", "false");\n|' \ platforms/android/build.gradle #Run the command to build and sign the apk CMD cordova build android --release -- --keystore=keystore --alias=alias1 {code} was (Author: danielcooper_xyz): I managed to recreate the issue with the weather-app in a container. Hopefully the dockerfile below helps. I've inserted the line into the build.gradle file, and that's still not fixed this issue. {code} FROM python:2.7-stretch RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - RUN apt-get install -y nodejs build-essential unzip default-jdk gradle WORKDIR /usr/src/android-sdk ENV sdk_file=sdk-tools-linux-3859397.zip RUN wget https://dl.google.com/android/repository/$sdk_file && unzip $sdk_file RUN yes | tools/bin/sdkmanager --licenses RUN tools/bin/sdkmanager "build-tools;27.0.2" "platforms;android-26" ENV ANDROID_HOME=/usr/src/android-sdk/ RUN npm install -g cordova WORKDIR /usr/src RUN git clone https://github.com/Microsoft/cordova-samples.git WORKDIR /usr/src/cordova-samples/weather-app/WeatherApp RUN cordova platform add android RUN keytool -genkey -noprompt \ -alias alias1 \ -dname "CN=test.com, OU=ID, O=foo, L=foo, S=foo, C=GB" \ -keystore keystore \ -storepass password \ -keypass password RUN sed -i 's|all sub-projects/modules.|all sub-projects/modules.\nSystem.setProperty("java.awt.headless", "false");\n|' \ platforms/android/build.gradle CMD cordova build android --release -- --keystore=keystore --alias=alias1 {code} > Not be able to sign apk with 6.4.0 and 7.0.0 > -------------------------------------------- > > Key: CB-13684 > URL: https://issues.apache.org/jira/browse/CB-13684 > Project: Apache Cordova > Issue Type: Bug > Components: cordova-android > Reporter: Kevin Lot > Assignee: Joe Bowser > > 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|https://github.com/gradle/gradle/issues/2826]). > If you don't specify passwords in config file to sign your APK, compilation > launches a window with SwingBuilder to prompt passwords. > {code:java} > 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); > } > } > {code} > 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. -- This message was sent by Atlassian JIRA (v6.4.14#64029) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org