Skip to content Skip to sidebar Skip to footer

Javafxports Multidex Minsdkversion Is Set To 20 Or Less

Researched the cause identified in this issue Link to initial cause of issue. The solution is to implement the required use of the android multidex library on android sdk versions

Solution 1:

Please have a look on an example project, I needed to create in Order to solve an issue with the UI rendering. Initially it was really slow and took up to 7s (2s FXML parsing, approx. 5s frozen UI) on my Nexus 6 and is now down to approx. 2.5s.

Here's the Manifest:

<?xml version="1.0" encoding="UTF-8"?><manifestxmlns:android="http://schemas.android.com/apk/res/android"package="eu.dzim.example"android:versionCode="1"android:versionName="1.0"><supports-screensandroid:xlargeScreens="true"/><uses-permissionandroid:name="android.permission.INTERNET"/><uses-permissionandroid:name="android.permission.READ_EXTERNAL_STORAGE"/><uses-permissionandroid:name="android.permission.WRITE_EXTERNAL_STORAGE"/><uses-sdkandroid:minSdkVersion="4"android:targetSdkVersion="21"/><applicationandroid:label="ExampleProject"android:name="android.support.multidex.MultiDexApplication"android:icon="@mipmap/ic_launcher"><activityandroid:name="javafxports.android.FXActivity"android:label="ExampleProject"android:configChanges="orientation|screenSize"><meta-dataandroid:name="main.class"android:value="eu.dzim.example.Main"/><meta-dataandroid:name="debug.port"android:value="0"/><intent-filter><actionandroid:name="android.intent.action.MAIN"/><categoryandroid:name="android.intent.category.LAUNCHER"/></intent-filter></activity></application></manifest>

Note:android:name="android.support.multidex.MultiDexApplication" on the <application> tag.

The Gradle file looks like:

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

apply plugin: 'org.javafxports.jfxmobile'

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

mainClassName = 'eu.dzim.example.Main'

dependencies {

    compile'com.gluonhq:charm:4.2.0'compile'org.controlsfx:controlsfx:8.40.12'compile'de.jensd:fontawesomefx-commons:8.13'compile'de.jensd:fontawesomefx-fontawesome:4.7.0'compile'de.jensd:fontawesomefx-materialdesignfont:1.7.22'compile'com.fasterxml.jackson.core:jackson-databind:2.8.4'

    compileNoRetrolambda 'com.airhacks:afterburner.mfx:1.6.2'
}

jfxmobile {
    downConfig {
    version = '3.1.0'
    plugins 'display', 'lifecycle', 'statusbar', 'storage', 'settings'
    }
    android {
    manifest = 'src/android/AndroidManifest.xml'
    compileSdkVersion = 22
    minSdkVersion = 19
    targetSdkVersion = 22
    dexOptions {
        javaMaxHeapSize '2g'
    }
    packagingOptions {
        pickFirst 'META-INF/LICENSE'
        pickFirst 'META-INF/NOTICE'
        pickFirst 'license/LICENSE.txt'
    }
    }
}

I created the Android/Desktop set-up with the IDE plugin for Eclipse (but this should not matter).

I just-rechecked it, build it and verified, that there were two dex files in build/javafxports/tmp/android/dex:

  • classes.dex
  • classes2.dex

I triggered the build via the task androidInstall and the app run as expected on a Nexus 5 test device.

So please: Compare those files with your set-up. Try to build and install it. As I said: It works fine for me...


Additionally I read on some other post here on StackOverflow, that one solved a dex-issue by simply using the correct JDK (64bit instead of 32bit). So make sure, your set-up beside the Gradle and Manifest is ok as well.

Post a Comment for "Javafxports Multidex Minsdkversion Is Set To 20 Or Less"