58

I just prepare small update for my android app, but I get this strange bug when I try to build my app (in debug mode). It will be great if someone smarter could look at this to figure out what might been wrong. I was cleaning/rebuild/fix project properties, but with no results. I have no clues what is going on :(. Maybe something similar happen to anyone here? If this can help I use following libraries: adMob(4.1.1), openfeint and libgdx.

here is building log:

UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lcom/google/api/client/escape/CharEscapers;
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at com.android.dx.dex.file.DexFile.add(DexFile.java:163)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at com.android.dx.command.dexer.Main.processClass(Main.java:486)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at com.android.dx.command.dexer.Main.processFileBytes(Main.java:455)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at com.android.dx.command.dexer.Main.access$400(Main.java:67)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:394)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at com.android.dx.command.dexer.Main.processOne(Main.java:418)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at com.android.dx.command.dexer.Main.processAllFiles(Main.java:329)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at com.android.dx.command.dexer.Main.run(Main.java:206)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at java.lang.reflect.Method.invoke(Method.java:616)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at com.android.ide.eclipse.adt.internal.build.DexWrapper.run(DexWrapper.java:179)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:745)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder.build(PostCompilerBuilder.java:647)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:629)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:172)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:282)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:363)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at org.eclipse.core.internal.resources.Project$1.run(Project.java:545)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:524)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at org.eclipse.core.internal.resources.Project.build(Project.java:123)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at com.android.ide.eclipse.adt.internal.project.ProjectHelper.build(ProjectHelper.java:869)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at com.android.ide.eclipse.adt.internal.launch.LaunchConfigDelegate.launch(LaunchConfigDelegate.java:146)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:853)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:702)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:924)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1128)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
[2011-12-08 21:56:42 - JellyBallsFree] Dx 1 error; aborting
[2011-12-08 21:56:42 - JellyBallsFree] Conversion to Dalvik format failed with error 1
Kubeczek
  • 893
  • 3
  • 11
  • 16
  • 12
    Guys, could you please use english on StackOverflow? – Anton Chikin Nov 20 '12 at 18:12
  • 3
    Are you using Gradle build for your project? I had a similar issue with duplicate jar files (remote and local)... – IgorGanapolsky Oct 21 '13 at 15:34
  • I saw this error when a .class file somehow landed under one of my src dirs (I use Ant and Eclipse, so it was one of them or me). In despair, I did a `git clean -dfx` (don't copy and paste unless you know the implications) and saw the errant class file get hosed. – Stephen Niedzielski Nov 09 '14 at 23:43

8 Answers8

88

You have same jar library included twice. Check your application and all referenced Android libraries and make sure you have all jars included exactly once.

If that does not help, take a look at http://tools.android.com/knownissues. Specifically look at first issue described in Build System section.

Also you can read this post: How to fix the “Conversion to Dalvik format failed with error 1"

inazaruk
  • 74,247
  • 24
  • 188
  • 156
  • 1
    Thanks for that clue. I double check everything and I had added twice open feint. First one as source files and second one as jar library. Don't know why it was building just fine last couple months, but it's possible that I update adt between last build and now (not totally sure). Anyway thanks again (for additional links also) :) – Kubeczek Dec 08 '11 at 21:57
6

I got this error after upgrading to R17.

My cause was different (ie not the *_src issue that occurred in R15). I had two different versions of a library in my "libs" folder. It appears that the Android plugin now automatically adds any jars in "libs" to the "Android Dependencies" section in the Package Explorer. Removing the old jar fixed the problem.

Paul LeBeau
  • 97,474
  • 9
  • 154
  • 181
5

I have the same problem and here is the solution:

Go to "Build" in the top and "Clean Project" and after "Rebuild the project" It helps me! Also you can go to "Files" and Invalidate caches" and restart the Android Studio

Of corse be sure that manifest is ok and no duplicate includes!

3

Check duplicated jar files.
Check lib entries in project.properties.
Clean all the included libs and build from scratch.

superarts.org
  • 7,009
  • 1
  • 58
  • 44
3

for bugs appeared after the SDK update to r17 you could check out this: http://tools.android.com/recent/dealingwithdependenciesinandroidprojects

Mehmed Mert
  • 935
  • 1
  • 7
  • 24
  • 1
    THANKS! How can I update you 10 times? That is really annoying that eclipse reports errors without saying what is really going on! – Karussell Jul 02 '12 at 07:52
1

I had same issue when I added android Ocr Api (tess-two) and imported sample application which was using this API but sample application and tess-two api had same packages thats why i was facing this issue, So I removed duplicate packages from my sample application and it was working fine.

Faraz Ahmed
  • 1,245
  • 1
  • 14
  • 24
0

I had the same problem. In my case, I had 2 jars in my libs folder, let's say A and B. A was a custom jar that I created and already had B included. This wasn't a problem until I updated to R17.
Solution: I removed B from libs.

Elyess Abouda
  • 659
  • 12
  • 20
0

Have a maps project in google_play_services/samples. Install jar from libproject to maven repository, add dependency to maps project and found that error. Using provided scope in dependency section solves the issue.

zhen_khokh
  • 69
  • 1
  • 8