我已经下载了 gluon 的示例应用程序并构建了它们。它们在桌面上运行得很好,但是当我在我的 android 手机上启动它们时,我收到“不幸的是 xxx 应用程序已停止”消息。Jose Pereda 的HelloCharm 也会发生同样的事情。
这是我从 HelloCharm 的 android 模拟器 logcat 中得到的:
Logcat
16:45:09.000 1120 org.jpereda.charm ERROR AndroidRuntime FATAL EXCEPTION: main
16:45:09.000 1120 org.jpereda.charm ERROR AndroidRuntime Process: org.jpereda.charm, PID: 1120
16:45:09.000 1120 org.jpereda.charm ERROR AndroidRuntime java.lang.RuntimeException: Did not create correct launcher.
16:45:09.000 1120 org.jpereda.charm ERROR AndroidRuntime at javafxports.android.FXDalvikEntity.getLauncherAndLaunchApplication(FXDalvikEntity.java:122)
16:45:09.000 1120 org.jpereda.charm ERROR AndroidRuntime at javafxports.android.FXDalvikEntity.surfaceCreated(FXDalvikEntity.java:145)
16:45:09.000 1120 org.jpereda.charm ERROR AndroidRuntime at android.view.SurfaceView.updateWindow(SurfaceView.java:572)
16:45:09.000 1120 org.jpereda.charm ERROR AndroidRuntime at android.view.SurfaceView.access$000(SurfaceView.java:86)
16:45:09.000 1120 org.jpereda.charm ERROR AndroidRuntime at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:175)
16:45:09.000 1120 org.jpereda.charm ERROR AndroidRuntime at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:847)
16:45:09.000 1120 org.jpereda.charm ERROR AndroidRuntime at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1871)
16:45:09.000 1120 org.jpereda.charm ERROR AndroidRuntime at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
16:45:09.000 1120 org.jpereda.charm ERROR AndroidRuntime at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5670)
16:45:09.000 1120 org.jpereda.charm ERROR AndroidRuntime at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
16:45:09.000 1120 org.jpereda.charm ERROR AndroidRuntime at android.view.Choreographer.doCallbacks(Choreographer.java:574)
16:45:09.000 1120 org.jpereda.charm ERROR AndroidRuntime at android.view.Choreographer.doFrame(Choreographer.java:544)
16:45:09.000 1120 org.jpereda.charm ERROR AndroidRuntime at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
16:45:09.000 1120 org.jpereda.charm ERROR AndroidRuntime at android.os.Handler.handleCallback(Handler.java:733)
16:45:09.000 1120 org.jpereda.charm ERROR AndroidRuntime at android.os.Handler.dispatchMessage(Handler.java:95)
16:45:09.000 1120 org.jpereda.charm ERROR AndroidRuntime at android.os.Looper.loop(Looper.java:136)
16:45:09.000 1120 org.jpereda.charm ERROR AndroidRuntime at android.app.ActivityThread.main(ActivityThread.java:5017)
16:45:09.000 1120 org.jpereda.charm ERROR AndroidRuntime at java.lang.reflect.Method.invokeNative(Native Method)
16:45:09.000 1120 org.jpereda.charm ERROR AndroidRuntime at java.lang.reflect.Method.invoke(Method.java:515)
16:45:09.000 1120 org.jpereda.charm ERROR AndroidRuntime at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
16:45:09.000 1120 org.jpereda.charm ERROR AndroidRuntime at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
16:45:09.000 1120 org.jpereda.charm ERROR AndroidRuntime at dalvik.system.NativeStart.main(Native Method)
16:45:09.000 1120 org.jpereda.charm ERROR AndroidRuntime Caused by: java.lang.RuntimeException: Failed to init method handles
16:45:09.000 1120 org.jpereda.charm ERROR AndroidRuntime at javafxports.android.DalvikLauncher.launchApp(DalvikLauncher.java:160)
16:45:09.000 1120 org.jpereda.charm ERROR AndroidRuntime at javafxports.android.FXDalvikEntity.getLauncherAndLaunchApplication(FXDalvikEntity.java:119)
16:45:09.000 1120 org.jpereda.charm ERROR AndroidRuntime ... 21 more
16:45:09.000 1120 org.jpereda.charm ERROR AndroidRuntime Caused by: java.lang.NoSuchMethodException: createEglSurface []
16:45:09.000 1120 org.jpereda.charm ERROR AndroidRuntime at java.lang.Class.getConstructorOrMethod(Class.java:472)
16:45:09.000 1120 org.jpereda.charm ERROR AndroidRuntime at java.lang.Class.getMethod(Class.java:857)
16:45:09.000 1120 org.jpereda.charm ERROR AndroidRuntime at javafxports.android.DalvikLauncher.initMethodHandles(DalvikLauncher.java:229)
16:45:09.000 1120 org.jpereda.charm ERROR AndroidRuntime at javafxports.android.DalvikLauncher.launchApp(DalvikLauncher.java:158)
16:45:09.000 1120 org.jpereda.charm ERROR AndroidRuntime ... 22 more
我不知道如何解决这个问题。
构建.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.0.1'
}
}
apply plugin: 'org.javafxports.jfxmobile'
repositories {
jcenter()
maven {
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases/'
}
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
}
ext.GLUON_VERSION = "0.0.3"
dependencies {
compile "com.gluonhq:charm:$GLUON_VERSION"
desktopRuntime "com.gluonhq:charm-desktop:$GLUON_VERSION"
androidRuntime "com.gluonhq:charm-android:$GLUON_VERSION"
iosRuntime "com.gluonhq:charm-ios:$GLUON_VERSION"
}
mainClassName = 'org.jpereda.charm.HelloCharm'
jfxmobile {
ios {
forceLinkClasses = [ 'org.jpereda.charm.**.*', 'com.gluonhq.charm.down.**.*' ]
}
android{
androidSdk = '/home/harvey/Documents/adt-bundle-linux-x86_64-20140321/sdk/'
dalvikSdk = '/home/harvey/Documents/adt-bundle-linux-x86_64-20140321/dalvik-sdk'
compileSdkVersion = 19
}
}