-main-dex-list中的类太多,javafxports-plugin

时间:2017-01-22 16:44:14

标签: javafxports

我正在尝试使用jfxmobile-plugin在Android设备上运行我的应用程序。

我做的时候

gradle android

在我的项目上我得到了

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)

我的gradle文件是这个

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
        }
    }
}

我发现了一些关于gradle构建记录的异常的类似问题,但到目前为止还没有给我带来真正的解决方案,特别是结合使用javafxports-plugin。

  • 有人建议将compileSdkVersion设置为21->的最小值。一世 使用24 - >这没有帮助。
  • 使用keepRuntimeAnnotatedClasses = false不是一个选项,因为 应用程序构建在一些Reflection / injection-logic上 (弹簧框架)。
  • 据我所知,构建过程将这些类考虑在内 放入main-dex文件,这是初始启动时需要的 应用。所以我将应用程序剥离到绝对最低限度 没有其他依赖(直接或传递)到另一个 我的应用程序库(没有从其他类中导入类) 库,java / javafx除外)。其他图书馆是 包含在'运行时fileTree ...' gradle文件的一部分但是 在启动时并没有真正使用过。想法是创造一个两阶段 启动应用程序:首先是最小应用程序然后是什么时候 加载最小应用程序,启动真正的应用程序代码。 - >没有 成功,似乎所有的图书馆都考虑到了 主-DEX文件。

我没有看到如何与javafxports一起解决它。有没有人有建议?

0 个答案:

没有答案
相关问题