java-运行默认的Gluon项目后出现错误(:dex FAILED)
作者:互联网
我为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
解决方法:
我有同样的问题现在已经解决了.现在我可以编译并使我的android apk了.
所以这些是我遵循的步骤
>确保您已更新SDK管理器->支持库
到最新版本(23.1.1),这对我来说是最新的
回答.这将更新
H:\sdk\extras\android\support\multidex files
>确保在build.gradle中添加android sdk位置
androidSdk =’H:/ ADT BUNDLE / 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上工作
Set environment variable name JAVA_OPTIONS with value Xmx1024M
如果您使用的是64位PC
make sure you install JDK that is 64 bit and not 32 bit JDK
标签:java,javafx,javafx-8,javafx-2,javafxports 来源: https://codeday.me/bug/20191011/1888956.html