3

I'm deloping a code in neatbeans on javafx with the latest gluon version, and when I run it in my laptop the program doesnt have problems, but when I try run in android

I achive this message

com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/INDEX.LIST File 1: C:\Users\User.gradle\caches\modules-2\files-2.1\org.javafxports\dalvik-sdk\8.60.8\6630ec66e4703c910ac3fd6151a8494c8b59186b\unpacked\dalvik-sdk\rt\lib\ext\jfxrt.jar File 2: C:\Users\User.gradle\caches\modules-2\files-2.1\org.javafxports\dalvik-sdk\8.60.8\6630ec66e4703c910ac3fd6151a8494c8b59186b\unpacked\dalvik-sdk\rt\lib\ext\jfxrt.jar

By now I'm using the recently Android's SDK version and I've tried many solutions propouse in this site like:

            exclude 'META-INF/LICENSE.txt'
            exclude 'META-INF/NOTICE.txt'
            exclude '...'
and more...

but I still cant get the solution.

This is my build.gladle file

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

apply plugin: 'org.javafxports.jfxmobile'

repositories {
    jcenter()
    maven {
        url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'   
    }
}

mainClassName = 'com.gluon_application.Gluon_Application'

dependencies {
    compile 'com.gluonhq:charm:4.3.0'
    compile 'eu.hansolo:Medusa:7.6'
    compile 'com.google.api-client:google-api-client:1.22.0'
    compile 'com.pi4j:pi4j-core:1.1'
    compile 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.0.2'
    compile 'de.jensd:fontawesomefx-commons:8.15'
    compile 'de.jensd:fontawesomefx-controls:8.15'

}

jfxmobile {
    downConfig {
        version = '3.2.0'
        // Do not edit the line below. Use Gluon Mobile Settings in your project context menu instead
        plugins 'display', 'lifecycle', 'orientation', 'statusbar', 'storage'
    }
    javafxportsVersion = '8.60.8'
    android {    
       manifest = 'src/android/AndroidManifest.xml'
       dexOptions {
            javaMaxHeapSize '3g'
        }
        packagingOptions {
            exclude 'META-INF/LICENSE.txt'
            exclude 'META-INF/NOTICE.txt'    
        }   
    }
    ios {
        infoPList = file('src/ios/Default-Info.plist')
        forceLinkClasses = [
                'com.gluonhq.**.*',
                'javax.annotations.**.*',
                'javax.inject.**.*',
                'javax.json.**.*',
                'org.glassfish.json.**.*'
        ]
    }
}

I get this error include using the sample code "Hello world"

What thing I should add in the script?

Regards

Rodrigo AB
  • 31
  • 2

1 Answers1

2

With the list of dependencies you have posted, this works for me:

jfxmobile {
    android {    
        packagingOptions {
            exclude 'META-INF/LICENSE'
            exclude 'META-INF/LICENSE.txt'
            exclude 'META-INF/NOTICE'
            exclude 'META-INF/NOTICE.txt'    
        }   
    }
}
José Pereda
  • 44,311
  • 7
  • 104
  • 132
  • 4
    Hi Jose thanks for your advice. After many days I can get the solutions with adding this line to the code that you share me: pickFirst 'META-INF/LICENSE.txt' pickFirst 'META-INF/NOTICE.txt' pickFirst 'META-INF/INDEX.LIST' Regards :) – Rodrigo AB Mar 25 '17 at 07:59
  • both of the answer and the lines in the comment helped me, thank you – SDIDSA Oct 03 '18 at 19:44