I have just created template Libgdx project (Core,Android,Windows). Core is regular Java project library. There is a dependency in Core to XStream.jar library. Core contains file input-output via Xml. Android project has dependency to java core project.
Now XStraem is working for Windows but not for Android. For Android i got this:
01-22 13:03:24.141: E/AndroidRuntime(25074): FATAL EXCEPTION: GLThread 5187
01-22 13:03:24.141: E/AndroidRuntime(25074): Process: com.barsoft.drag, PID: 25074
01-22 13:03:24.141: E/AndroidRuntime(25074): java.lang.NoClassDefFoundError: com.thoughtworks.xstream.XStream
01-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)
If I am adding library to the build path in Android project i got:
[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;
The same stuff is when I check libraries in Core -> Order and Export
From LibGDX doc about creating core project:
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.
Does that mean that any dependency included within Java core project won't work on Android? Is there a way to get XStream transit lib working?