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 20 or less.
The issue now is how to implement the solution detailed at this link Using multidex when minSdkVersion is set to 20 or lower
Extract from link.
If you do override the Application class, change it to extend MultiDexApplication (if possible) as follows:
public class MyApplication extends MultiDexApplication { ... }
Or if you do override the Application class but it's not possible to change the base class, then you can instead override the attachBaseContext() method and call MultiDex.install(this) to enable multidex:
public class MyApplication extends SomeOtherApplication { @Override protected void attachBaseContext(Context base) { super.attachBaseContext(context); Multidex.install(this); } }
The full package names for the classes mentioned in the above code are
android.support.multidex.MultiDexApplication
android.app.Application
The javafx application extends javafx.application.Application
The question is - how to implemented the multidex solution when extending javafx.application.Application
when using javafxports?
Now including the AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ie.murphysoftware.games.magnatron"
android:versionCode="5"
android:versionName="5.0">
<supports-screens android:xlargeScreens="true" />
<uses-sdk android:minSdkVersion="21"/>
<application android:icon="@drawable/magnatron_icon" android:label="@string/app_name">
<activity android:name="javafxports.android.FXActivity"
android:label="@string/app_name"
android:screenOrientation="portrait">
<meta-data android:name="launcher.class" android:value="javafxports.android.DalvikLauncher" />
<!-- Full name of the application class to run -->
<meta-data android:name="main.class"
android:value="ie.murphysoftware.games.magnatron.MagnatronStart" />
<!-- Jvm arguments (delimiter |) -->
<meta-data android:name="jvm.args"
android:value="-Djavafx.verbose=true|-Djavafx.name=value" />
<!--This meta-data tag is required to use Google Play Services.-->
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
<!-- Application arguments (delimiter |) -->
<meta-data android:name="app.args" android:value="arg1|arg2" />
<!-- Jdwp debugging port. Don't forget to forward port (adb forward tcp:port1 tcp:port2) -->
<meta-data android:name="debug.port" android:value="0" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
</application>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"></uses-permission>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="com.android.vending.BILLING"></uses-permission>
</manifest>
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:
Note:
android:name="android.support.multidex.MultiDexApplication"
on the<application>
tag.The Gradle file looks like:
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
: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.