When I do a
gradle android
with the jfxmobile-plugin on my JavaFX-application I get
...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':mergeClassesIntoJar'.
> archive contains more than 65535 entries.
To build this archive, please enable the zip64 extension.
See: https://docs.gradle.org/3.2.1/dsl/org.gradle.api.tasks.bundling.Zip.html#org.gradle.api.tasks.bundling.Zip:zip64
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
The gradle file looks like this:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.3.2'
}
}
apply plugin: 'org.javafxports.jfxmobile'
mainClassName = 'de.package.of.application.ClientApp'
dependencies {
compile 'com.annimon:stream:1.0.1'
compile 'com.jakewharton.threetenabp:threetenabp:1.0.4'
compile 'com.gluonhq:charm:3.0.0'
androidRuntime 'com.gluonhq:charm-android:3.0.0'
iosRuntime 'com.gluonhq:charm-ios:3.0.0'
desktopRuntime 'com.gluonhq:charm-desktop:3.0.0'
compile fileTree(dir: 'target/dependencies', include: '*.jar')
runtime fileTree(dir: 'target/dependencies', include: '*.jar')
}
repositories {
jcenter()
maven {
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
}
jfxmobile {
ios {
forceLinkClasses = ['ensemble.**.*']
}
android {
applicationPackage = 'org.javafxports.ensemble'
compileSdkVersion = '21'
androidSdk='C:/Tools/android-sdk-windows'
}
}
Over the last years since Javafx exists the application has become, I would say, a 'bigger' one; a fat-client with many own classes but also many third-party dependencies.
I found an article about the jfxmobile-plugin and thought 'Why not give it a try?'. The current issue is the one described in this question.
I already stripped down the application to reduce classes to a minimum so the application still makes some sense in some way but it does not help.
Does anyone have a suggestions how to solve it?
Related
I am trying to run simply the Gluon single scene example. Here is my gradle output:
Configuration on demand is an incubating feature.
> Configure project :GluonApplicationApp
Project :GluonApplicationApp => no module-info.java found
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':GluonApplicationApp'.
> Could not create task ':GluonApplicationApp:debug'.
> Unnecessarily replacing a task that does not exist is not supported. Use create() or register() directly instead. You attempted to replace a task named 'debug', but there is no existing task with that name.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
My build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.3.17'
}
}
apply plugin: 'org.javafxports.jfxmobile'
repositories {
jcenter()
maven {
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
}
mainClassName = 'com.gluonapplication.GluonApplication'
dependencies {
compile 'com.gluonhq:charm:5.0.2'
}
jfxmobile {
downConfig {
version = '3.8.6'
// Do not edit the line below. Use Gluon Mobile Settings in your project context menu instead
plugins 'display', 'lifecycle', 'statusbar', 'storage'
}
android {
manifest = 'src/android/AndroidManifest.xml'
}
}
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'org.openjfx:javafx-plugin:0.0.9'
}
}
apply plugin: 'org.openjfx.javafxplugin'
The JDK version i'm using is JDK 11, and I have tried various gradle versions. For my IDE I use netbeans.
I have been trying to fix this all day. Please help
I was using the old Gluon IDE plugin
Gluon build 0.1.29-SNAPSHOT fixes the rest of the problems
More details on comments of the question!
I'm using GluonHQ's JavaFX to create mobile applications for Android. I'm using OpenJDK 8 and OpenJFX 8.
asus#asus-pc:~/Dokument/Eclipse-Workspace/Deeplearning2C$ java -version
openjdk version "1.8.0_222"
OpenJDK Runtime Environment (build 1.8.0_222-8u222-b10-1ubuntu1~19.04.1-b10)
OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)
asus#asus-pc:~/Dokument/Eclipse-Workspace/Deeplearning2C$
When I generate a android application, I write this command.
asus#asus-pc:~/Dokument/Eclipse-Workspace/Deeplearning2C$ ./gradlew android
But I get this error. I don't understand what it is and I have never got that before.
> Task :Deeplearning2CApp:dex FAILED
[ant:java] Java Result: 2
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':Deeplearning2CApp:dex'.
> UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Too many classes in --main-dex-list, main dex capacity exceeded
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:548)
at com.android.dx.command.dexer.Main.runMultiDex(Main.java:368)
at com.android.dx.command.dexer.Main.runDx(Main.java:289)
at com.android.dx.command.dexer.Main.main(Main.java:247)
at com.android.dx.command.Main.main(Main.java:94)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 6m 57s
11 actionable tasks: 9 executed, 2 up-to-date
asus#asus-pc:~/Dokument/Eclipse-Workspace/Deeplearning2C$
According to this question, the suggestions in the answer was was:
(The easiest solution, but not suitable for most of the applications) Change your minSdkVersion to 21.
Shrink your application code. This was discussed many times previously (see here and here).
If none of the above solutions work for you, you can try to use my workaround for this issue - I'm patching the Android gradle plugin to not include Activity classes in main dex. It's a bit hacky, but works well for me.
Too many classes in --main-dex-list, main dex capacity exceeded
My project is very minimal and I don't use many dependencies at all. So I cannot shrink down my code. That's is impossible for me. I cannot change the SDK version because I'm running at the lowest Java 8 version. The last suggestion I don't want to try because I don't like "quick hacks" for projects.
Do you think it has something with Deeplearning4J dependency?
My gradle.build file looks like this:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.3.17'
}
}
apply plugin: 'org.javafxports.jfxmobile'
repositories {
jcenter()
maven {
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
}
mainClassName = 'se.danielmartensson.Main'
dependencies {
compile 'com.gluonhq:charm:5.0.2'
compile group: 'org.deeplearning4j', name: 'deeplearning4j-core', version: '1.0.0-beta4'
compile group: 'org.nd4j', name: 'nd4j-native-platform', version: '1.0.0-beta4'
compile group: 'org.datavec', name: 'datavec-api', version: '1.0.0-beta4'
compile group: 'org.projectlombok', name: 'lombok', version: '1.18.8'
}
jfxmobile {
downConfig {
version = '3.8.6'
// Do not edit the line below. Use Gluon Mobile Settings in your project context menu instead
plugins 'display', 'lifecycle', 'statusbar', 'storage'
}
android {
manifest = 'src/android/AndroidManifest.xml'
}
ios {
infoPList = file('src/ios/Default-Info.plist')
forceLinkClasses = [
'se.danielmartensson.**.*',
'com.gluonhq.**.*',
'javax.annotations.**.*',
'javax.inject.**.*',
'javax.json.**.*',
'org.glassfish.json.**.*'
]
}
}
My project can be downloaded from here:
https://github.com/DanielMartensson/Deeplearning2C
Edit:
I tried to compile gradle.build file with dexOptions . Se below and the error too.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.3.17'
}
}
apply plugin: 'org.javafxports.jfxmobile'
repositories {
jcenter()
maven {
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
}
mainClassName = 'se.danielmartensson.Main'
dependencies {
compile 'com.gluonhq:charm:5.0.2'
compile group: 'org.deeplearning4j', name: 'deeplearning4j-core', version: '1.0.0-beta4'
compile group: 'org.nd4j', name: 'nd4j-native-platform', version: '1.0.0-beta4'
compile group: 'org.datavec', name: 'datavec-api', version: '1.0.0-beta4'
compile group: 'org.projectlombok', name: 'lombok', version: '1.18.8'
}
jfxmobile {
downConfig {
version = '3.8.6'
// Do not edit the line below. Use Gluon Mobile Settings in your project context menu instead
plugins 'display', 'lifecycle', 'statusbar', 'storage'
}
android {
manifest = 'src/android/AndroidManifest.xml'
dexOptions {
additionalParameters = ['--minimal-main-dex']
keepRuntimeAnnotatedClasses = false
javaMaxHeapSize = '4g'
}
}
ios {
infoPList = file('src/ios/Default-Info.plist')
forceLinkClasses = [
'se.danielmartensson.**.*',
'com.gluonhq.**.*',
'javax.annotations.**.*',
'javax.inject.**.*',
'javax.json.**.*',
'org.glassfish.json.**.*'
]
}
}
Error output:
> Task :Deeplearning2CApp:dex
[ant:java] Java Result: 1
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':Deeplearning2CApp:dex'.
> warning: Ignoring InnerClasses attribute for an anonymous inner class
(EDU.oswego.cs.dl.util.concurrent.FutureResult$1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
..
...
.....
......
.......
warning: Ignoring InnerClasses attribute for an anonymous inner class
(EDU.oswego.cs.dl.util.concurrent.misc.TestLoop$1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000701100000, 401080320, 0) failed; error='Cannot allocate memory' (errno=12)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 6m 52s
11 actionable tasks: 9 executed, 2 up-to-date
asus#asus-pc:~/Dokument/Eclipse-Workspace/Deeplearning2C$
Gradle cannot resolve org.apache.commons:commons-imaging, yet it is available in all 3 of the provided repositories:
http://jump-pilot.sourceforge.net/repository
https://repo.adobe.com/nexus/content/repositories/public/
https://repository.apache.org/content/repositories/snapshots/
This part of the log is interesting, Gradle looks only in jcenter and the local filesystem:
https://jcenter.bintray.com/org/apache/commons/commons-imaging/1.0-SNAPSHOT/maven-metadata.xml
https://jcenter.bintray.com/org/apache/commons/commons-imaging/1.0-SNAPSHOT/commons-imaging-1.0-SNAPSHOT.pom
https://jcenter.bintray.com/org/apache/commons/commons-imaging/1.0-SNAPSHOT/commons-imaging-1.0-SNAPSHOT.jar
file:/Users/user/Library/Android/sdk/extras/android/m2repository/org/apache/commons/commons-imaging/1.0-SNAPSHOT/maven-metadata.xml
file:/Users/user/Library/Android/sdk/extras/android/m2repository/org/apache/commons/commons-imaging/1.0-SNAPSHOT/commons-imaging-1.0-SNAPSHOT.pom
file:/Users/user/Library/Android/sdk/extras/android/m2repository/org/apache/commons/commons-imaging/1.0-SNAPSHOT/commons-imaging-1.0-SNAPSHOT.jar
file:/Users/user/Library/Android/sdk/extras/google/m2repository/org/apache/commons/commons-imaging/1.0-SNAPSHOT/maven-metadata.xml
file:/Users/user/Library/Android/sdk/extras/google/m2repository/org/apache/commons/commons-imaging/1.0-SNAPSHOT/commons-imaging-1.0-SNAPSHOT.pom
file:/Users/user/Library/Android/sdk/extras/google/m2repository/org/apache/commons/commons-imaging/1.0-SNAPSHOT/commons-imaging-1.0-SNAPSHOT.jar
Console log (requesting org.apache.commons:commons-imaging:1.0-SNAPSHOT):
$ react-native run-android
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not find org.apache.commons:commons-imaging:1.0-SNAPSHOT.
Searched in the following locations:
https://jcenter.bintray.com/org/apache/commons/commons-imaging/1.0-SNAPSHOT/maven-metadata.xml
https://jcenter.bintray.com/org/apache/commons/commons-imaging/1.0-SNAPSHOT/commons-imaging-1.0-SNAPSHOT.pom
https://jcenter.bintray.com/org/apache/commons/commons-imaging/1.0-SNAPSHOT/commons-imaging-1.0-SNAPSHOT.jar
file:/Users/user/Library/Android/sdk/extras/android/m2repository/org/apache/commons/commons-imaging/1.0-SNAPSHOT/maven-metadata.xml
file:/Users/user/Library/Android/sdk/extras/android/m2repository/org/apache/commons/commons-imaging/1.0-SNAPSHOT/commons-imaging-1.0-SNAPSHOT.pom
file:/Users/user/Library/Android/sdk/extras/android/m2repository/org/apache/commons/commons-imaging/1.0-SNAPSHOT/commons-imaging-1.0-SNAPSHOT.jar
file:/Users/user/Library/Android/sdk/extras/google/m2repository/org/apache/commons/commons-imaging/1.0-SNAPSHOT/maven-metadata.xml
file:/Users/user/Library/Android/sdk/extras/google/m2repository/org/apache/commons/commons-imaging/1.0-SNAPSHOT/commons-imaging-1.0-SNAPSHOT.pom
file:/Users/user/Library/Android/sdk/extras/google/m2repository/org/apache/commons/commons-imaging/1.0-SNAPSHOT/commons-imaging-1.0-SNAPSHOT.jar
Required by:
ReactNativeProject:app:unspecified > ReactNativeProject:react-native-image-store-ext:unspecified
Console log (requesting org.apache.commons:commons-imaging:+):
$ react-native run-android
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not find any matches for org.apache.commons:commons-imaging:+ as no versions of org.apache.commons:commons-imaging are available.
Required by:
ReactNativeProject:app:unspecified > ReactNativeProject:react-native-image-store-ext:unspecified
build.gradle:
buildscript {
repositories { jcenter() }
dependencies { classpath 'com.android.tools.build:gradle:2.1.0' }
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
lintOptions { abortOnError false }
}
repositories {
mavenCentral()
maven { url "http://jump-pilot.sourceforge.net/repository" }
maven { url "https://repo.adobe.com/nexus/content/repositories/public/" }
maven { url "https://repository.apache.org/content/repositories/snapshots/" }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile "com.facebook.react:react-native:+"
compile 'org.apache.commons:commons-imaging:+'
}
There are 2 build.gradle file in android project: the one inside main project folder and the one inside app folder. The repository should be defined under allprojects block inside project folder. Here, example of my build.gradle which successful build apache commons imaging.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "http://jump-pilot.sourceforge.net/repository" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Apparently, there is no oficial version for apache commons imaging yet.
The latest unoficial version I have found, is on this repo
maven { url "http://wcm.io/maven/repositories/apache-intermediate-release/" }
Add this line on the build.gradle as opris said.
Then, in your gradle app/module file, add this
dependencies {
...
implementation 'org.apache.commons:commons-imaging:1.0-R1725432'
...
}
I haven't tested it yet, so I will have to choose between this one and the oficial version of sanselan,
compile 'org.apache.sanselan:sanselan:0.97-incubator'
which has no more support
I am trying to make my application run on an android device by using the jfxmobile-plugin.
When I do a
gradle android
on my project I get
Execution failed for task ':dex'.
> UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Too many classes in --main-dex-list, main dex capacity exceeded
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:546)
at com.android.dx.command.dexer.Main.runMultiDex(Main.java:366)
at com.android.dx.command.dexer.Main.run(Main.java:275)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)
My gradle file is this
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.3.2'
}
}
apply plugin: 'org.javafxports.jfxmobile'
mainClassName = 'de.package.of.application.ClientApp'
dependencies {
compile 'com.annimon:stream:1.0.1'
compile 'com.jakewharton.threetenabp:threetenabp:1.0.4'
compile 'com.gluonhq:charm:4.2.0'
androidRuntime 'com.gluonhq:charm-android:3.0.0'
iosRuntime 'com.gluonhq:charm-ios:3.0.0'
desktopRuntime 'com.gluonhq:charm-desktop:3.0.0'
compile fileTree(dir: 'target/dependencies', include: '*.jar')
runtime fileTree(dir: 'target/dependencies', include: '*.jar')
}
repositories {
jcenter()
maven {
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
}
jfxmobile {
ios {
forceLinkClasses = ['ensemble.**.*']
}
android {
//manifest = 'AndroidManifest.xml'
compileSdkVersion = '24'
androidSdk='C:/Tools/android-sdk-windows'
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
//... some more excludes
}
dexOptions {
javaMaxHeapSize '3g'
// keepRuntimeAnnotatedClasses false
}
}
}
I found some similar questions about the exception logged by the gradle build but non brought a real solution for me so far especially in combination with the usage of the javafxports-plugin.
Some suggested to set the compileSdkVersion to a minumum of 21-> I
use 24 -> this does not help.
Using keepRuntimeAnnotatedClasses=false is not an option because the
application is build on some Reflection/injection-logic
(spring-framework).
As I understand the build process takes those classes into account to
put in the main-dex-file which are required to initially start up the
application. So I stripped down the application to an absolut minimum
with no other dependencies (direct or transitive) to the other
libraries of my application (no imports of classes from other
libraries, except to java/javafx). The other libraries are
included by the 'runtime fileTree...' part of the gradle-file but
are not really used at startup. Idea was to create a 2-phase
startup of the application: First a minimum-app and then, when
the minimum app is loaded, start the real application code. -> no
success, it seems all libraries are taken into account for the
main-dex-file.
I do not see how to solve it together with javafxports. Does anyone have suggestions?
I have a dependencies problem I need help with.
I can build EGLSource fin on its own.
But when i try to build EGL2JS then I get this error:
Error message:
:compileJava
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all dependencies for configuration ':compile'.
> Could not find :swt-64:.
Searched in the following locations:
https://repo1.maven.org/maven2//swt-64//swt-64-.pom
https://repo1.maven.org/maven2//swt-64//swt-64-.jar
Required by:
:EGL2JS:unspecified > EGL2JS:EGLSource:unspecified
Build and settings files for the two projects: EGLSource and EGL2JS.
EGL2JS: settings.gradle
include ':EGLSource'
project(':EGLSource').projectDir = new File(settingsDir, '../EGLSource')
EGL2JS: build.gradle
apply plugin: 'java'
repositories {
mavenCentral()
}
dependencies {
compile project(':EGLSource')
}
sourceSets {
main {
java.srcDirs = ['src', 'target/generated-sources']
}
}
EGLSource: build.gradle
apply plugin: 'java'
repositories {
flatDir {
dirs 'lib'
}
}
dependencies {
compile name: 'swt-64'
}
sourceSets {
main {
java.srcDirs = ['src', 'target/generated-sources/antlr4']
}
}
Why is EGL2JS complaining about a dependency in EGLSource?
I could add the swt-64.jar to EGL2JS. But EGL2JS does not directly depend on swt-64.jar so I don't like that solution.
Are there other ways to resolve this dependency?
For reasons I don't understand this makes a difference.
Removing flatFile from repositories
and changing dependencies
from:
compile name: 'swt-64'
to:
dependencies {
compile fileTree(dir: 'lib', include: 'swt-64.jar')
}
Also gradle dependencies not longer shows swt-64 failed.