使用胶子移动插件为JavaFX安卓应用程序构建失败 [英] Build failure for JavaFX android app using the gluon mobile plugin
问题描述
我刚刚用FXML开始了一个新的胶子移动多视图项目,并尝试在更改任何内容之前运行它(除了将build.gradle文件中的jfxmobile-plugin版本从1.2.0更新到1.3.2之外)。它在桌面上工作正常,但当我尝试运行androidinstall gradle任务(连接我的android手机)时它失败了。它给了我以下错误:
:mergeClassesIntoJar
:shrinkMultiDexComponents
:createMainDexList
: writeInputListFile
[ant:java] Java结果:1
:dex FAILED
FAILURE:构建因异常而失败。
*出了什么问题:
任务执行失败':dex'。
> org.gradle.api.GradleException(无错误消息)
*尝试:
使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获取更多日志输出。
BUILD FAILED
我的build.gradle文件:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.3.2'
}
}
apply plugin:'org.javafxports.jfxmobile'
repositories {
jcenter()
maven {
url'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
}
mainClassName ='com.gluonapplication.GluonApplication'
依赖项{
compile'com.gluonhq:charm:4.2.0'
}
jfxmobile {
downConfig {
version ='3.1.0'
//不要编辑下面的行。在项目上下文菜单中使用Gluon Mobile Settings而不是
插件'display','lifecycle','statusbar','storage'
}
android {
manifest ='src / android / AndroidManifest.xml'
}
}
操作系统:Windows 10 。
如果需要任何其他信息来确定问题的原因,请告诉我。谢谢。
gradlew --info android log:
根据您的日志,我注意到您在64位操作系统上使用32位JDK:
启动进程'命令'C:\Program Files(x86)\ Java \ _jdk1.8.0_101 \ bin\java.exe ''。工作目录:D:\Android_Projects \ GluonMobile-MultiViewProjectwithFXML命令:C:\Program Files(x86)\ Java \ _ddk1.8.0_101 \bin\java.exe ...
默认情况下,jfxmobile插件 sets Android上的JVM Xmx选项为2 GB,考虑到无法分配的32位操作系统,解决方案是设置较低的值。
基于此行代码,你可以se t:
android {
dexOptions {
javaMaxHeapSize'1g'
}
}
或者多一点(1.5g左右?)。
请注意,如果使用64位JDK,这将解决。确保相应地更新JAVA_HOME环境变量,因为您不需要减少进程的内存。
I just started a new gluon mobile multi view project with FXML and tried to run it before changing anything (apart from updating the jfxmobile-plugin version in the build.gradle file from 1.2.0 to 1.3.2). it works fine on desktop, but when i try to run the androidinstall gradle task (with my android phone connected) it fails. It gives me the following error:
:mergeClassesIntoJar
:shrinkMultiDexComponents
:createMainDexList
:writeInputListFile
[ant:java] Java Result: 1
:dex FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':dex'.
> org.gradle.api.GradleException (no error message)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
my build.gradle file:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.3.2'
}
}
apply plugin: 'org.javafxports.jfxmobile'
repositories {
jcenter()
maven {
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
}
mainClassName = 'com.gluonapplication.GluonApplication'
dependencies {
compile 'com.gluonhq:charm:4.2.0'
}
jfxmobile {
downConfig {
version = '3.1.0'
// Do not edit the line below. Use Gluon Mobile Settings in your project context menu instead
plugins 'display', 'lifecycle', 'statusbar', 'storage'
}
android {
manifest = 'src/android/AndroidManifest.xml'
}
}
operating system: Windows 10.
Please let me know if any additional information is needed to determine the cause of the problem. Thank you.
gradlew --info android log:
Based on your log, I noticed you were using a 32 bits JDK on a 64 bits OS:
Starting process 'command 'C:\Program Files (x86)\Java\jdk1.8.0_101\bin\java.exe''. Working directory: D:\Android_Projects\GluonMobile-MultiViewProjectwithFXML Command: C:\Program Files (x86)\Java\jdk1.8.0_101\bin\java.exe ...
By default, the jfxmobile plugin sets 2 GB for the JVM Xmx option on Android, and considering that on a 32 bits OS that won't be possible to allocate, the solution is setting a lower value.
Based on this line of code, you can set:
android {
dexOptions {
javaMaxHeapSize '1g'
}
}
Or maybe a little bit more (1.5g or so?).
Note that this will be solved if you use a 64 bits JDK. Make sure you update your JAVA_HOME environment variable accordingly, as you won't need to reduce the memory for your process.
这篇关于使用胶子移动插件为JavaFX安卓应用程序构建失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!