How to build Android source code example with Eclipse (Cling 2.0.1)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How to build Android source code example with Eclipse (Cling 2.0.1)

hoangth
This post was updated on .
I've looked at source code at here https://github.com/4thline/cling/tree/master/demo/android (actually I used the source code that came with Cling 2.0.1 distribution)

But after weeks try to build it with my Eclipse, I have no success

I found an article about this here http://datababel.wordpress.com/2013/07/29/upnp-client-in-android-with-cling-getting-started/ but the instruction is still not clear enough.

I want to use Maven *with* Eclipse to simplify the work have to be done, but in that article, it seems they didn't use Maven but the jetty jar directly

Can someone please give me a step by step how to build the Android source code with Eclipse using Maven (the pom.xml file that came with source code)?

Thank you very much

Edit 1

I've tried the solution: Open the .jar file and delete about.html in each .jar, then compress them again. I included 8 jetty .jar file in my project according to this article http://www.gubatron.com/blog/2013/03/12/jar-dependencies-if-you-plan-to-use-the-cling-upnp-library-in-your-android-project/

jetty-security-8.1.8.v20121106.jar
jetty-http-8.1.8.v20121106.jar
jetty-continuation-8.1.8.v20121106.jar
jetty-io-8.1.8.v20121106.jar
jetty-util-8.1.8.v20121106.jar
jetty-server-8.1.8.v20121106.jar
jetty-servlet-8.1.8.v20121106.jar
jetty-client-8.1.8.v20121106.jar

And this is the error log when I run in Eclipse

[2014-12-07 12:07:20 - GR2] Dx
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dx.cf.iface.ParseException: class name (org/eclipse/jetty/http/AbstractGenerator) does not match path (org.eclipse.jetty.http_8.1.8.v20121106/org/eclipse/jetty/http/AbstractGenerator.class)
    at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:520)
    at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
    at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
    at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
    at com.android.dx.command.dexer.Main.processClass(Main.java:665)
    at com.android.dx.command.dexer.Main.processFileBytes(Main.java:634)
    at com.android.dx.command.dexer.Main.access$600(Main.java:78)
    at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572)
    at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
    at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
    at com.android.dx.command.dexer.Main.processOne(Main.java:596)
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264)
    at com.android.dx.command.dexer.Main.run(Main.java:230)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at com.android.ide.eclipse.adt.internal.build.DexWrapper.run(DexWrapper.java:188)
    at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:786)
    at com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder.build(PostCompilerBuilder.java:597)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:734)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:206)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:328)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:403)
    at org.eclipse.core.internal.resources.Project$1.run(Project.java:618)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2313)
    at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:597)
    at org.eclipse.core.internal.resources.Project.build(Project.java:124)
    at com.android.ide.eclipse.adt.internal.project.ProjectHelper.doFullIncrementalDebugBuild(ProjectHelper.java:1143)
    at com.android.ide.eclipse.adt.internal.launch.LaunchConfigDelegate.launch(LaunchConfigDelegate.java:155)
    at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:885)
    at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:739)
    at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1039)
    at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1256)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
...while parsing org.eclipse.jetty.http_8.1.8.v20121106/org/eclipse/jetty/http/AbstractGenerator.class

[2014-12-07 12:07:20 - GR2] Dx 1 error; aborting
[2014-12-07 12:07:20 - GR2] Conversion to Dalvik format failed with error 1