我正在尝试使用jfxmobile-plugin在Android设备上运行我的应用程序。
最后一个
gradle androidInstall
传递,我的设备上安装了apk。 我的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 = '21'
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
}
}
}
当设备启动应用程序时,黑屏会显示几秒钟,然后会弹出一条消息:'应用已停止'。 我连接到设备 adb logcat -v threadtime 该日志包含几个例外,我将在此处列出:
01-15 18:11:09.356 16952 16952 E dalvikvm: Unable to extract+optimize DEX from '/data/data/de.package.of.application/code_cache/secondary-dexes/de.package.of.application-1.apk.classes6.zip'
......
01-15 18:11:09.366 16952 16952 W MultiDex: Exception in makeDexElement
01-15 18:11:09.366 16952 16952 W MultiDex: java.io.IOException: unable to open DEX file
.....
01-15 18:11:09.376 16952 16952 E MultiDex: Multidex installation failure
01-15 18:11:09.376 16952 16952 E MultiDex: java.lang.NoSuchFieldException: Field dexElementsSuppressedExceptions not found in class dalvik.system.PathClassLoader
.....
java.lang.RuntimeException: Unable to instantiate application android.support.multidex.MultiDexApplication: java.lang.RuntimeException: Multi dex installation failed (Field dexElementsSuppressedExceptions not found in class dalvik.system.PathClassLoader).
...
01-15 18:11:09.386 16952 16952 E AndroidRuntime: Caused by: java.lang.RuntimeException: Multi dex installation failed (Field dexElementsSuppressedExceptions not found in class dalvik.system.PathClassLoader).
01-15 18:11:09.386 16952 16952 E AndroidRuntime: at android.support.multidex.MultiDex.install(MultiDex.java:178)
AndroidManifest.xml是由插件'默认生成的。 one,在gradle文件中没有定义manifest文件时使用(如文档所述)。
<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="de.package.of.application" android:versionCode="1" android:versionName="1.0">
<supports-screens android:xlargeScreens="true"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="21"/>
<application android:label="main-client" android:name="android.support.multidex.MultiDexApplication">
<activity android:name="javafxports.android.FXActivity" android:label="main-client" android:configChanges="orientation|screenSize">
<meta-data android:name="main.class" android:value="de.package.of.application.ClientApp"/>
<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>
</application>
</manifest>
到目前为止我也尝试过:
有人有建议吗?