gpt4 book ai didi

java.lang.NoClassDefFoundError : javafxports. android.FXDalvikEntity$2

转载 作者:太空宇宙 更新时间:2023-11-04 11:55:59 24 4
gpt4 key购买 nike

在 Android 手机上启动我的应用程序时出现以下错误

FATAL EXCEPTION: main
Process: ie.murphysoftware.games.magnatron, PID: 17378
java.lang.NoClassDefFoundError: javafxports.android.FXDalvikEntity$2
at javafxports.android.FXDalvikEntity.jfxEventsLoop(FXDalvikEntity.java:484)
at javafxports.android.FXDalvikEntity.<init>(FXDalvikEntity.java:118)
at javafxports.android.FXActivity.onCreate(FXActivity.java:140)
at android.app.Activity.performCreate(Activity.java:5426)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2269)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2363)
at android.app.ActivityThread.access$900(ActivityThread.java:161)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5356)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
at dalvik.system.NativeStart.main(Native Method)

在 Android 版本 KitKat API Level 19 以及可能较低版本的 Android 上运行应用时,会出现此错误。

APK中有2个dex类

  • classes.dex
  • classes2.dex

问题似乎是主 dex 文件 classes.dex 包含类 FXDalvikEntity ,而 classes2.dex 包含其子类

  • FXDalvikEntity$1
  • FXDalvikEntity$2
  • FXDalvikEntity$InternalSurfaceView
  • FXDalvikEntity$InternalTextureView
  • FXDalvikEntity$SurfaceDetails

当应用程序启动时,会加载 classes.dex 中包含的类,但不会加载 classes2.dex 中的类,这会导致错误。

Is there a way to force dex to only create one dex file?

我的构建环境是

Eclipse - Neon
Gradle 3.1
compileSdkVersion = 25
minSdkVersion = 17
buildToolsVersion = "25.0.0"
applicationPackage = 'org.javafxports.ensemble'

最佳答案

这就是您收到的异常所表明的内容:

Thrown if the Java Virtual Machine or a ClassLoader instance tries to load in the definition of a class (as part of a normal method call or as part of creating a new instance using the new expression) and no definition of the class could be found.

(来源:https://docs.oracle.com/javase/7/docs/api/java/lang/NoClassDefFoundError.html)

这意味着,在您的应用程序中(直接或间接)访问的类在运行时环境中不存在。因此,您可能需要选择较新的版本作为运行时环境。另一个原因可能是您使用的依赖项不存在(我不确定 Android 应用程序如何处理第 3 方依赖项),您需要将它们包含到您的应用程序中。

关于java.lang.NoClassDefFoundError : javafxports. android.FXDalvikEntity$2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41393148/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com