我试图添加System.setProperty(‘java.awt.headless’,’false’),但它没有用,我发现谷歌上没有什么新东西….
解决方法 只需在导入groovy.swing.SwingBuilder之前添加System.setProperty(‘java.awt.headless’,’false’)并使用./gradlew -stop杀死gradle deamonError:(20,1) Failed to create component for ‘dialog’ reason:
java.awt.headlessExceptionjava.awt.headlessException (no error message)
import groovy.swing.SwingBuildergradle.taskGraph.whenReady { taskGraph -> def storePassword = '' def keyPassword = '' if (System.console() == null) { new SwingBuilder().edt { dialog(modal: true,Title: 'Enter password',alwaysOntop: true,resizable: false,locationrelativeTo: null,pack: true,show: true) { vBox { label(text: "Please enter store passphrase:") def input1 = passwordFIEld() label(text: "Please enter key passphrase:") def input2 = passwordFIEld() button(defaultbutton: true,text: 'OK',actionPerformed: { storePassword = input1.password; keyPassword = input2.password; dispose(); }) } } } } else { storePassword = System.console().readPassword("\nPlease enter store passphrase: ") keyPassword = System.console().readPassword("\nPlease enter key passphrase: ") } if (storePassword.size() <= 0 || keyPassword.size() <= 0) { throw new InvalIDUserDataException("You must enter the passwords to proceed.") } storePassword = new String(storePassword) keyPassword = new String(keyPassword) androID.signingConfigs.Keys.storePassword = storePassword androID.signingConfigs.Keys.keyPassword = keyPassword}
它给你的东西:
apply plugin: 'com.androID.application'System.setProperty('java.awt.headless','false')import groovy.swing.SwingBuilder总结
以上是内存溢出为你收集整理的android – 无法为’dialog’原因创建组件:java.awt.HeadlessException全部内容,希望文章能够帮你解决android – 无法为’dialog’原因创建组件:java.awt.HeadlessException所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)