Libgdx,Android的传递依赖项,Java库项目,Jar

Libgdx,Android的传递依赖项,Java库项目,Jar,第1张

概述我刚刚创建了模板Libgdx项目(Core,Android,Windows).核心是常规的Java项目库.Core中对XStream.jar库有依赖性.Core包含通过Xml输入和输出的文件.Android项目具有对Java核心项目的依赖.现在,XStraem适用于Windows,但不适用于Android.对于Android,我得到了:01-2213:03:24.141:

我刚刚创建了模板libgdx项目(Core,Android,windows).核心是常规的Java项目库. Core中对XStream.jar库有依赖性. Core包含通过Xml输入和输出的文件. AndroID项目具有对Java核心项目的依赖.

现在,XStraem适用于windows,但不适用于AndroID.对于AndroID,我得到了:

01-22 13:03:24.141: E/AndroIDRuntime(25074): FATAL EXCEPTION: GLThread 518701-22 13:03:24.141: E/AndroIDRuntime(25074): Process: com.barsoft.drag, PID: 2507401-22 13:03:24.141: E/AndroIDRuntime(25074): java.lang.NoClassDefFoundError: com.thoughtworks.xstream.XStream01-22 13:03:24.141: E/AndroIDRuntime(25074):    at com.barsoft.drag.managers.XmlManager.loadFromfileautoType(XmlManager.java:29)01-22 13:03:24.141: E/AndroIDRuntime(25074):    at com.barsoft.drag.managers.ObjectManager.createObjectautoType(ObjectManager.java:66)01-22 13:03:24.141: E/AndroIDRuntime(25074):    at com.barsoft.drag.Game.create(Game.java:36)01-22 13:03:24.141: E/AndroIDRuntime(25074):    at com.badlogic.gdx.backends.androID.AndroIDGraphics.onSurfaceChanged(AndroIDGraphics.java:334)01-22 13:03:24.141: E/AndroIDRuntime(25074):    at androID.opengl.GLSurfaceVIEw$GLThread.guardedRun(GLSurfaceVIEw.java:1512)01-22 13:03:24.141: E/AndroIDRuntime(25074):    at androID.opengl.GLSurfaceVIEw$GLThread.run(GLSurfaceVIEw.java:1240)

如果我将库添加到AndroID项目的构建路径中,则会得到:

[2014-01-22 13:23:06 - Dex Loader] Unable to execute dex: Multiple dex files define Lorg/xmlpull/v1/XmlPullParser;[2014-01-22 13:23:06 - drag-androID] Conversion to Dalvik format Failed: Unable to execute dex: Multiple dex files define Lorg/xmlpull/v1/XmlPullParser;

当我在Core中检查库时,同样的东西->订购和出口

来自libGDX的有关创建核心项目的文档:

Main project setup Create a new Java project in Eclipse: file -> New
-> Project -> Java Project. Give it a name and click Finish.

Go to the project folder on the file system and create a sub-folder named libs.
Download the nightly zip and place gdx.jar and gdx-sources.jar in the
libs folder.

In Eclipse, right click the project -> Refresh. Right
click again -> PropertIEs -> Java Build Path -> librarIEs -> Add JARs,
select gdx.jar and click OK.

Under the gdx.jar file, double click
“Source attachment”, click Workspace, select the gdx-sources.jar and
click OK.

Click the Order and Export tab, check the gdx.jar and click
OK.

Note: Step 5 makes gdx.jar a transitive dependency. That means that
projects that depend on the main project will also have gdx.jar on
their classpath. However, this doesn’t work for AndroID projects.

这是否意味着Java核心项目中包含的任何依赖项在AndroID上均不起作用?
有没有办法让XStream传输库正常工作?

解决方法:

如果AndroID上支持该库,则它将起作用.

将其放在Core项目的“ libs”文件夹中.将其添加到其订单和导出标签.

将其添加到AndroID项目的“库”标签中. (“添加罐子”,而不是“添加外部罐子”),然后在“订单和以及导出选项卡.

That means that projects that depend on the main project will also have gdx.jar on their classpath. However, this doesn’t work for AndroID projects.

这只是意味着Core项目的类路径中的库不会自动添加到AndroID项目中(据我所知,前一段时间确实如此).

如果出现多个dex文件错误.取消选中“订购和订购”中的私人图书馆. AndroID项目的“导出”选项卡.

总结

以上是内存溢出为你收集整理的Libgdx,Android的传递依赖项,Java库项目,Jar全部内容,希望文章能够帮你解决Libgdx,Android的传递依赖项,Java库项目,Jar所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1094398.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-28
下一篇 2022-05-28

发表评论

登录后才能评论

评论列表(0条)

保存