2017-02-02 85 views
0

我剛開始使用FXML創建一個新的膠子移動多視圖項目,並試圖在更改任何內容之前運行它(除了將build.gradle文件中的jfxmobile插件版本更新爲1.2.0至1.3.2)。它在桌面上工作正常,但是當我嘗試運行androidinstall gradle任務(連接我的android手機)時失敗。它給了我下面的錯誤:使用膠子移動插件構建JavaFX android應用程序失敗

: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 

我的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' 

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' 
    } 
} 

操作系統:Windows 10

請讓我知道是否需要任何額外的信息來確定問題的原因。謝謝。

gradlew --info的Android日誌:

http://pastebin.com/yNZbZcVk

JDK version

+0

你可以運行'gradlew.bat --info android'併發布日誌? –

+0

感謝您的快速回復。我在我的文章中添加了日誌(由於此站點上的字符限制使用了pastebin)。我也跟着提出的解決方案,在這篇文章http://stackoverflow.com/questions/30473854/error-after-running-the-default-gluon-project-dex-failed沒有運氣。 – Jonathan

+0

您正在64位操作系統上運行32位JDK版本,不是嗎?你可以試試64位JDK嗎? –

回答

1

根據你的日誌,我注意到你正在使用一個64位操作系統在32位JDK:

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 ... 

默認情況下,Android上的JVM Xmx選項的jfxmobile插件sets 2 GB,並考慮到32位操作系統不可能分配,解決方案是設置一個較低的值。在此基礎上line的代碼

,您可以設置:

android { 
    dexOptions { 
      javaMaxHeapSize '1g' 
    } 
} 

或者更多一點點(1.5克左右?)。

請注意,如果您使用64位JDK,這將得到解決。確保相應地更新您的JAVA_HOME環境變量,因爲您不需要減少進程的內存。

+0

我安裝了JDK 32和64位。擺脫了32位JDK,現在它可以在不減小堆大小的情況下工作。再次感謝。 – Jonathan

相關問題