0

The situation I have is that I have an Android Project (regular) which uses Amazon AWS android libr jars (inside libs folder). I recently cloned Autobahn (https://github.com/tavendo/AutobahnAndroid) and I'm using this library project on my own. The problem is that Amazon library uses jackson and it's contained in aws jar core jars. Since Autobahn also has that dependenciy I'm getting the following exception when generating the apk:

java.lang.IllegalArgumentException: already added: Lorg/codehaus/jackson/Base64Variant;

Since I can't modify the amazon library, is there any way I can tell Autobahn project to do not "export" jackson libs dependencies into my own project?

fr4gus
  • 396
  • 7
  • 18

3 Answers3

0

The problem is that Amazon library uses jackson and it's contained in aws jar core jars

:: grumble, grumble ::

is there any way I can tell Autobahn project to do not "export" jackson libs dependencies into my own project?

Not that I am aware of. But you could make your fork for Autobahn depend upon the AWS JAR instead and get rid of its own copy of Jackson. That presumes that Amazon's embedded Jackson is complete and compatible with Autobahn, though.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
0

The JAR at https://autobahn.s3.amazonaws.com/android/autobahn-0.5.0.jar is pure library only with Autobahn classes and no reference to Jackson.

The archive https://autobahn.s3.amazonaws.com/android/autobahn-0.5.0.zip contains - as a convenience - both the Autobahn and Jackson JARs.

When you are using Autobahn source from GitHub, that will contain project files (plus examples and so on), which then sets up the dependency on Jackson.

You can build your own JAR from the source by going to the Autobahn directory within the repo and do a ant jar. Then, only put that JAR into your project. That should work.

oberstet
  • 21,353
  • 10
  • 64
  • 97
  • I tried that but for some reason it's creating an empty jar (just the meta inf stuff). I'll check it out again. Thanks!. – fr4gus Sep 21 '12 at 18:08
  • BTW I'm using the project on Git because I saw your response in another question, suggesting the usage of the project on git http://stackoverflow.com/questions/9586676/autobahn-websockets-android-demo-crashes. – fr4gus Sep 21 '12 at 18:15
  • Yeah, using the repo source instead of JAR is probably better. The `ant jar` stuff _should_ work though. If it doesn't, feel free to submit an issue on Github. – oberstet Sep 22 '12 at 07:54
0

I had a very similar problem with Unable to execute dex: Multiple dex files define Lorg/codehaus/jackson/Base64Variant using Google Drive api's and Google Spreadsheet api's. This may help.

Tried all the usual Eclipse fix methods, clean, rebuilding, start/stopping Eclipse, new workspace, etc.

If you are using Eclipse, this is how I solved it without having to manage the .jar's.

1) In Eclipse, right click your project properties

2) Click on Java Compiler

3) Click on Building

4) Click on Configure Workspace Settings

5) Click on Enable project specific settings

6) Click on Output Folder

7) Click 'Rebuild class files modified by others'

Hope this helps.

Peter Birdsall
  • 3,159
  • 5
  • 31
  • 48