I get Execution failed for task ':ChatAppGluonApp:applyRetrobuffer'.
trying to create an Android APK. I'm Using Eclipse Oxygen (4.7.3RC2) and Windows 7. The same error comes up with macOs 10.13.1 and Eclipse Oxygen (4.7.2). On both operating systems I'm using Android 26 with Build Tools 26.0.2.
I tried running using Java 8 and 9, but the outcome was the same. The program works fine on Desktop.
buildscript {
repositories {
jcenter()
google()
maven{
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:2.0.17'
}
}
apply plugin: 'org.javafxports.jfxmobile'
repositories {
jcenter()
maven {
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
}
mainClassName = 'de.....ChatApplication'
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
compile 'com.gluonhq:charm:4.4.0-jdk9'
androidRuntime 'com.gluonhq:charm:4.4.1'
compile 'com.airhacks:afterburner.mfx:1.6.3'
compile files('libs/chatFx.jar')
//compile files('libs/chatFxTest.jar')
compile files('libs/miglayout-core-5.0.jar')
compile files('libs/miglayout-javafx-5.0.jar')
// https://mvnrepository.com/artifact/org.slf4j/slf4j-api
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25'
// https://mvnrepository.com/artifact/com.google.code.findbugs/jsr305
compile group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2'
// https://mvnrepository.com/artifact/javax.xml.ws/jaxws-api
compile group: 'javax.xml.ws', name: 'jaxws-api', version: '2.2.6'
}
jfxmobile {
downConfig {
version = '3.7.0'
// Do not edit the line below. Use Gluon Mobile Settings in your project context menu instead
plugins 'display', 'lifecycle', 'statusbar', 'storage'
}
android {
compileSdkVersion = '26'
buildToolsVersion = '26.0.2'
manifest = 'src/android/AndroidManifest.xml'
}
ios {
infoPList = file('src/ios/Default-Info.plist')
forceLinkClasses = [
'com.gluonhq.**.*',
'javax.annotations.**.*',
'javax.inject.**.*',
'javax.json.**.*',
'org.glassfish.json.**.*'
]
}
}
Based on your exception for the applyRetrobuffer
task:
15:26:29.974 [ERROR] [system.err] java.lang.IllegalArgumentException
15:26:29.974 [ERROR] [system.err] at org.objectweb.asm.ClassReader.<init>(Unknown Source)
15:26:29.974 [ERROR] [system.err] at org.objectweb.asm.ClassReader.<init>(Unknown Source)
15:26:29.974 [ERROR] [system.err] at org.javafxports.retrobuffer.ClassAnalyzer.analyze(ClassAnalyzer.java:48)
15:26:29.974 [ERROR] [system.err] at org.javafxports.retrobuffer.Retrobuffer$1.visitClass(Retrobuffer.java:59)
15:26:29.974 [ERROR] [system.err] at org.javafxports.retrobuffer.ClasspathVisitor.visitFile(ClasspathVisitor.java:59)
15:26:29.974 [ERROR] [system.err] at org.javafxports.retrobuffer.ClasspathVisitor.visitFile(ClasspathVisitor.java:41)
15:26:29.974 [ERROR] [system.err] at java.base/java.nio.file.Files.walkFileTree(Files.java:2713)
15:26:29.974 [ERROR] [system.err] at java.base/java.nio.file.Files.walkFileTree(Files.java:2785)
15:26:29.974 [ERROR] [system.err] at org.javafxports.retrobuffer.Retrobuffer.run(Retrobuffer.java:56)
15:26:29.975 [ERROR] [system.err] at org.javafxports.retrobuffer.Main.main(Main.java:45)
Android doesn't support Java 9, so when using jfxmobile 2.0.+ all your Android dependencies have to be compiled with Java 8 target.
In your case, the exception indicates that there's still at least one class on the classpath that has been compiled with java 9 or higher as the target.
There is already a filed issue to show more information about the class that produces the failure.
I can't say about your local dependencies, but the rest work fine for me. As for miglayout-*-5.0
, unless you have compiled a local version, it is from 2014.
Anyway, just make sure that you add this to any local dependency you build yourself with Java 9:
sourceCompatibility = 1.8
targetCompatibility = 1.8
As an aside, when you manage to apply the retrobuffer task successfully, you will have some conflicts with duplicated files from dependencies, like META-INF/LICENSE.txt
being in different jars. Use packagingOptions
, like in this link.