这是我在项目中使用的 build.gradle ,在我的项目中将Datafx作为依赖项后得到此异常。This是我项目的github链接。我试过了
1. gradle clean
2. 清除缓存
3. 我已经提到了这个post
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.3.5'
}
}
apply plugin: 'org.javafxports.jfxmobile'
repositories {
jcenter()
maven {
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
}
mainClassName = 'com.appliction.Main'
dependencies {
compile 'com.gluonhq:glisten-afterburner:1.2.0'
compile 'de.jensd:fontawesomefx-materialicons:2.2.0-5'
compileNoRetrolambda 'com.jfoenix:jfoenix:1.5.0'
compile 'io.datafx:datafx:8.0.1'
compile 'io.datafx:flow:8.0.1'
compile 'io.datafx:injection:8.0.1'
}
jfxmobile {
downConfig {
version = '3.2.4'
plugins 'display', 'lifecycle', 'local-notifications', 'runtime-args', 'statusbar', 'storage'
}
android {
minSdkVersion '3'
compileSdkVersion '26'
targetSdkVersion '26'
manifest = 'src/android/AndroidManifest.xml'
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
}
ios {
infoPList = file('src/ios/Default-Info.plist')
forceLinkClasses = [
'com.application.**.*',
'com.gluonhq.**.*',
'javax.annotations.**.*',
'javax.inject.**.*',
'javax.json.**.*',
'org.glassfish.json.**.*'
]
}
}
执行此任务时遇到此异常 gradle:android
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':apkDebug'.
> com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/services/io.datafx.controller.context.resource.AnnotatedControllerResourceType
File 1: C:\Users\guru\.gradle\caches\modules-2\files-2.1\io.datafx\flow\8.0.1\eb5efe930962872fd9f27c7c751b806ab3965bca\flow-8.0.1.jar
File 2: C:\Users\guru\.gradle\caches\modules-2\files-2.1\io.datafx\flow\8.0.1\eb5efe930962872fd9f27c7c751b806ab3965bca\flow-8.0.1.jar
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
根据前面提到的问题的答案,我尝试了这个问题
android
{
manifest = 'src/android/AndroidManifest.xml'
packagingOptions {
exclude 'META-INF/services/io.datafx.controller.context.resource.AnnotatedControllerResourceType'
}
}
并且任务gradle:android
已成功完成,但在将此应用程序安装到我的手机时遇到了问题。打开应用程序时,它会显示空白屏幕而不再显示。
这里是{{1结果我得到了应用程序的启动。
adb logcat