4

我下载了 Netbeans 的 Gluon 插件,以将 JavaFX 应用程序部署到 Android。它在桌面上成功运行,但是当我执行android任务时,它会抛出一个错误:

Executing: gradle :android

:compileJava UP-TO-DATE
:compileRetrolambdaMain UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:compileAndroidJava UP-TO-DATE
:compileRetrolambdaAndroid SKIPPED
:compileTestJava UP-TO-DATE
:compileRetrolambdaTest SKIPPED
:compileRetrolambda UP-TO-DATE
:mergeClassesIntoJar
:validateManifest
:collectMultiDexComponents
:shrinkMultiDexComponents
:createMainDexList
[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

Total time: 4 mins 29.297 secs

这是我的软件配置:

  • 我用的是JDK8u45(我还设置了JAVA_HOME的路径)
  • 我将 Netbeans 8.0.2 用于 IDE
  • 我下载了带有 API21 的 Android SDK(我还为 ANDROID_HOME 设置了路径)
  • 我下载了 Gradle2.4(我还设置了 GRADLE_HOME 的路径)
  • 我用于Windows XP操作系统(32 位)

该错误的原因可能是什么?

这是 build.gradle:

 buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'org.javafxports:jfxmobile-plugin:1.0.0-b9'
    }
}

apply plugin: 'org.javafxports.jfxmobile'

repositories {
    jcenter()
}

mainClassName = 'com.gluon.GlounMainApp'

jfxmobile {
    android {
        manifest = 'src/android/AndroidManifest.xml'
    }
    ios {
        infoPList = file('src/ios/Default-Info.plist')
    }
}

这是堆栈跟踪:

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task':dex'.
at      org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
at  org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:305)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:23)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:88)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62)
at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:68)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:55)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:149)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:80)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:36)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:51)
at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionRep
ortingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:33)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at  org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.ja
va:30)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:127)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:58)
Caused by: org.gradle.api.GradleException:
at org.javafxports.jfxmobile.plugin.android.task.Dex.dex(Dex.groovy:45)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:218)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:211)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:200)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:579)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:562)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at  org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
... 47 more

这是 --debug 输出:

Finished executing task ':dex'
11:36:09.171 [LIFECYCLE] [class org.gradle.TaskExecutionLogger] :dex FAILED
11:36:09.187 [INFO]  [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :dex (Thread[main,5,main]) completed. Took 0.391 secs.
11:36:09.203 [DEBUG]  [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] Task worker  [Thread[main,5,main]] finished, busy: 1 mins 18.97 secs, idle: 0.421secs 11:36:09.265 [ERROR] [org.gradle.BuildExceptionReporter]
11:36:09.265 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
11:36:09.281 [ERROR] [org.gradle.BuildExceptionReporter]
11:36:09.296 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
11:36:09.312 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':dex'.
11:36:09.312 [ERROR] [org.gradle.BuildExceptionReporter] > org.gradle.api.Gradle
Exception (no error message)
11:36:09.328 [ERROR] [org.gradle.BuildExceptionReporter]
11:36:09.343 [ERROR] [org.gradle.BuildExceptionReporter] * Try:
11:36:09.343 [ERROR] [org.gradle.BuildExceptionReporter] Run with --stacktrace option to get the stack trace.
11:36:09.359 [LIFECYCLE] [org.gradle.BuildResultLogger]
11:36:09.375 [LIFECYCLE] [org.gradle.BuildResultLogger] BUILD FAILED
11:36:09.390 [LIFECYCLE] [org.gradle.BuildResultLogger]
11:36:09.390 [LIFECYCLE] [org.gradle.BuildResultLogger] Total time: 2 mins 13.48
4 secs
11:36:09.406 [DEBUG] [org.gradle.api.internal.tasks.compile.daemon.CompilerDaemonManager                                                                       ]
                                                                           Stopping 0 compiler daemon(s).
11:36:09.421 [INFO] [org.gradle.api.internal.tasks.compile.daemon.CompilerDaemonManager                                                                        ]
                                                                           Stopped 0 compiler daemon(s).
11:36:09.421 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on buildscript class cache for build file  'C:\HelloGluon\build.gradle' (C:\gradle\caches\2.2.1\scripts\build_80spgxfpvahlvz1v3mywr9rd1\ProjectScript\buil
dscript).
11:36:09.437 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on no_buildscript class cache for build file 'C:\HelloGluon\build.gradle'
 (C:\gradle\caches\2.2.1\scripts\build_80spgxfpvahlvz1v3mywr9rd1\ProjectScript\no_buildscript).
11:36:09.453 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache                                                                            ]
                                                                           Closing cache fileHashes.bin (C:\HelloGluon\.gradle\2.2.1\taskArtifacts\fileHashe
s.bin)
11:36:09.453 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache                                                                             ]
                                                                           Closing cache fileSnapshots.bin (C:\HelloGluon\.gradle\2.2.1\taskArtifacts\fileSn
apshots.bin)
11:36:09.468 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache                                                                              ]
                                                                           Closing cache taskArtifacts.bin (C:\HelloGluon\.gradle\2.2.1\taskArtifacts\taskArtifacts.bin)
11:36:09.484 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache                                                                              ]
                                                                           Closing cache outputFileStates.bin (C:\HelloGluon\.gradle\2.2.1\taskArtifacts\outputFileStates.bin)
11:36:09.484 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on task history cache (C:\HelloGluon\.gradle\2.2.1\taskArtifacts).
11:36:09.500 [DEBUG] [org.gradle.cache.internal.DefaultCacheAccess] Cache Plugin
 Resolution Cache (C:\gradle\caches\2.2.1\plugin-resolution) was closed 0 times.

 11:36:09.500 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache                                                                              ]
                                                                           Closing cache artifact-at-repository.bin (C:\gradle\caches\modules-2\metadata-2.14\artifact-at-repository.bin)
11:36:09.515 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache                                                                              ]
                                                                           Closing cache module-metadata.bin (C:\gradle\caches\modules-2\metadata-2.14\module-metadata.bin)
11:36:09.531 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on artifact cache (C:\gradle\caches\modules-2).
 11:36:09.531 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.memcache.InMemoryCachedRepositoryFactory                                         ]
                                                                            In-memory dependency metadata cache closed. Repos cached: 4, cache instances: 1,modules served from cache: 0, artifacts: 0
11:36:09.546 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.    store.CachedStoreFactory                                                      ]
                                                                          Resolution result cache closed. Cache reads: 0, disk reads: 0 (avg: 0.0 secs, total: 0.0 secs)
 11:36:09.562 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.CachedStoreFactory                                                      ]
                                                                           Resolved configuration cache closed. Cache reads: 0, disk reads: 0 (avg: 0.0 secs, total: 0.0 secs)
11:36:09.562 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.ResolutionResultsStoreFactory                                           ]
                                                                            Deleted 2 resolution results binary files in 0.016 secs
4

1 回答 1

4

我现在遇到了同样的问题。现在我可以编译并制作我的 android apk 了。

所以这些是我遵循的步骤

  1. 确保您已将您的 sdk 管理器 -> 支持库更新到最新版本(23.1.1),当我发布此答案时,它对我来说是最新的。这将更新

H:\sdk\extras\android\support\multidex 文件

  1. 确保在 build.gradle androidSdk='H:/ADT BUNDLE/sdk' 中添加您的 android sdk 位置

像这样

buildscript {
    repositories {
        jcenter()
    }
    dependencies {

           classpath 'org.javafxports:jfxmobile-plugin:1.0.0-b9'


    }
}

apply plugin: 'org.javafxports.jfxmobile'


repositories {
    jcenter()
}

mainClassName = 'com.fff.Fff'

jfxmobile {
    android {
        manifest = 'src/android/AndroidManifest.xml'
        androidSdk='H:/ADT BUNDLE/sdk'

    }
}

如果您在 32 位 PC 上工作

使用值 Xmx1024M 设置环境变量名称 JAVA_OPTIONS

如果您在 64 位 PC 上工作

确保安装 64 位的 JDK 而不是 32 位的 JDK

于 2015-12-22T10:40:57.890 回答