在Libgx中使用PEXML for android时java.lang.No classDefFound错误

时间:2016-08-31 16:37:36

标签: libgdx

我正在使用PEXML库为我的游戏中的物体提供物理效果。它在桌面上工作得非常好,但是当我在android中运行时,它在代码 playerPhysics = new PEXML(Gdx.files.internal("data/physics.xml").file()); 给我错误 并显示错误

  

java.lang.NoClassDefFoundError:解析失败:Ljavax / xml / bind / JAXBContext;在com.hi5dev.box2d_pexml.PEXML.loadXML(PEXML.java:124)com.hi5dev.box2d_pexml.PEXML。(PEXML.java:24)
    引起:java.lang.ClassNotFoundException:没找到类" javax.xml.bind.JAXBContext"在路径上:DexPathList [[dex file" /data/data/com.myplayer.football/files/instant-run/dex/slice-slice_9 ...

1 个答案:

答案 0 :(得分:1)

Google search shows javax.xml.bind.JAXBContext is in the file javax.xml.bind.jar

Java needs to find this file at runtime. It looks for it in your Java classpath ( set of directories ).

You need this Jar to be in your runtime classpath

The error you wrote about shows you the classpath.

You can either

  1. put javax.xml.bind.jar in the current classpath or
  2. Modify the classpath to include the location of javax.xml.bind.jar

Lookup how to modify the Java classpath for your operating system.