I have a problem.
I have an application builded with monodroid libraries.
Version of android sdk 4.0.3 (API level 15), GoogleAdMobAdsSdk v.6.4.1.
I made separated project to import adsdk to xamarin, add to Metadata.xml attributes. This project compiling without errors. But when i have a reference to this project from my monodroid application i get an error:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: Error: Tool exited with code: 3. Output:
UNEXPECTED TOP-LEVEL ERROR:
java.lang.OutOfMemoryError: Java heap space
at com.android.dx.util.IntList.growIfNeeded(IntList.java:274)
at com.android.dx.util.IntList.add(IntList.java:217)
at com.android.dx.util.LabeledList.addLabelIndex(LabeledList.java:96)
at com.android.dx.util.LabeledList.set(LabeledList.java:184)
at com.android.dx.rop.code.BasicBlockList.set(BasicBlockList.java:77)
at com.android.dx.ssa.back.SsaToRop.convertBasicBlocks(SsaToRop.java:260)
at com.android.dx.ssa.back.SsaToRop.convert(SsaToRop.java:124)
at com.android.dx.ssa.back.SsaToRop.convertToRopMethod(SsaToRop.java:70)
at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:102)
at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:73)
at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:273)
at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:134)
at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:87)
at com.android.dx.command.dexer.Main.processClass(Main.java:487)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:459)
at com.android.dx.command.dexer.Main.access$400(Main.java:67)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:398)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
at com.android.dx.command.dexer.Main.processOne(Main.java:422)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:333)
at com.android.dx.command.dexer.Main.run(Main.java:209)
at com.android.dx.command.dexer.Main.main(Main.java:174)
at com.android.dx.command.Main.main(Main.java:91)
(MyMegaMonoDroidApplication)
Where is my error?
ThnX.
Please specify the Java Heap Size = 1G (or 512M might help you).
Here is how to do that for Xamarin Studio https://stackoverflow.com/a/24833518/883738
In Visual Studio you should do that in the Android project properties
I have created an android application that uses android-support-v4.jar.
Now when I add an android library to this project I get this error when building:
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoIcsImpl;
[2012-11-08 16:02:31 - ShoppingApp Android] Conversion to Dalvik format failed with error 1
The library I'm trying to add is Facebook SDK, which also happens to use android-support-v4.jar.
Only solution for this error I found was removing library from one of build paths, but I can't do it - all options all disabled when I select this jar.
Here is full error trace:
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoIcsImpl;
at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
at com.android.dx.dex.file.DexFile.add(DexFile.java:163)
at com.android.dx.command.dexer.Main.processClass(Main.java:486)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:455)
at com.android.dx.command.dexer.Main.access$400(Main.java:67)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:394)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
at com.android.dx.command.dexer.Main.processOne(Main.java:418)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:329)
at com.android.dx.command.dexer.Main.run(Main.java:206)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.android.ide.eclipse.adt.internal.build.DexWrapper.run(DexWrapper.java:180)
at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:703)
at com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder.build(PostCompilerBuilder.java:577)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:321)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:396)
at org.eclipse.core.internal.resources.Project$1.run(Project.java:618)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
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:1000)
at com.android.ide.eclipse.adt.internal.launch.LaunchConfigDelegate.launch(LaunchConfigDelegate.java:147)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:855)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:704)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1047)
at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1251)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
[2012-11-08 16:02:31 - ShoppingApp Android] Dx 1 error; aborting
[2012-11-08 16:02:31 - ShoppingApp Android] Conversion to Dalvik format failed with error 1
The build process checks the checksum of every jar and raises this error if the jar is found twice and the jars have different checksums.
This means you have the same library twice but two different versions of the jar file, which doesn't make sense.
If you added a library project, you don't need the support library in your app, you can delete it as it is inherited from the project library.
You might want to update the jar of the support library into the library project.
Edit: you don't play with the build path anymore, your libraries folders should be "libs" and it will appear in the project as "Android dependencies". Then you remove the jar from your libs folder of your app, and maybe update the one from the library project.
This error means that you have some classes included more than once in your build. I've solved quite the same problem with mvn dependencies in eclipse by unchecking "Export maven decencies" in Project configuration/Java Build Path/Export.
This is not a question because I already found the answer.
The new Android SDK 17 has a stricter dependency check on jar files.
At the same time, they added a jar that I think wasn't there before. My project encountered a conflict between the new annotations.jar in the SDK and one that I already used. Replacing one by the other would work, if they have the same origin.
My annotations.jar is from jetbrains, via a Guice dependency, so replacing it doesn't work. This is the error I got:
[2012-03-22 10:54:27 - MyApp] Jar mismatch! Fix your dependencies
[2012-03-22 10:54:46 - MyApp] Found 2 versions of annotations.jar in the dependency list,
[2012-03-22 10:54:46 - MyApp] but not all the versions are identical (check is based on SHA-1 only at this time).
[2012-03-22 10:54:46 - MyApp] All versions of the libraries must be the same at this time.
[2012-03-22 10:54:46 - MyApp] Versions found are:
[2012-03-22 10:54:46 - MyApp] Path: /opt/android-sdk-linux_x86/tools/support/annotations.jar
[2012-03-22 10:54:46 - MyApp] Length: 1463
[2012-03-22 10:54:46 - MyApp] SHA-1: 6f59fa3a223df6f332bee8b8bffb526f7445018b
[2012-03-22 10:54:46 - MyApp] Path: /home/christine/workspace/MyApp/libs/annotations.jar
[2012-03-22 10:54:46 - MyApp] Length: 7593
[2012-03-22 10:54:46 - MyApp] SHA-1: e28fe9e70610beb9ef49226a9e56fed7a86e742a
[2012-03-22 10:54:46 - MyApp] Jar mismatch! Fix your dependencies
My annotations.jar is from jetbrains, via a Guice dependency. I renamed this file to jetbrains-annotation.jar which solved my problem.
I am following the android licensing documentation (http://developer.android.com/guide/publishing/licensing.html) and when i get to the step that I add the reference of the licensing project (in eclipse) to my project, I get an error in the console (see below) and my project doesnt build. Any ideas on how i can around this? I tried a couple searches on google, but I didnt come up with anything. Thanks.
Error seen:
[2010-09-26 05:54:41 - MyApp] ERROR: Unknown option '--auto-add-overlay'
[2010-09-26 05:54:41 - MyApp] Android Asset Packaging Tool
[2010-09-26 05:54:41 - MyApp]
[2010-09-26 05:54:41 - MyApp] Usage:
[2010-09-26 05:54:41 - MyApp] aapt l[ist] [-v] [-a] file.{zip,jar,apk}
[2010-09-26 05:54:41 - MyApp] List contents of Zip-compatible archive.
[2010-09-26 05:54:41 - MyApp]
[2010-09-26 05:54:41 - MyApp] aapt d[ump] [--values] WHAT file.{apk} [asset [asset ...]]
[2010-09-26 05:54:41 - MyApp] badging Print the label and icon for the app declared in APK.
[2010-09-26 05:54:41 - MyApp] permissions Print the permissions from the APK.
[2010-09-26 05:54:41 - MyApp] resources Print the resource table from the APK.
[2010-09-26 05:54:41 - MyApp] configurations Print the configurations in the APK.
[2010-09-26 05:54:41 - MyApp] xmltree Print the compiled xmls in the given assets.
[2010-09-26 05:54:41 - MyApp] xmlstrings Print the strings of the given compiled xml assets.
...
OP: Did you manage to solve your problem?
I'm also getting this into problem while trying to use th LVL. I get this error in addition:
"Target 'Android 2.1' does not support building project with libraries."
Thanks.
Solved:
An SDK update was necessary. "Android 2.1" revision 1 was installed and revision 2 is necessary in order to use Library projects.
http://developer.android.com/guide/developing/eclipse-adt.html#libraryReqts
I am building an app on android and running into an error and while searching on net, came across your posting on this and changed the eclipse.ini to increase Xms and Xmx params but still this error does not go away.
I am using Eclipse IDE for Java with Android SDK 2.1 on Mac OS. Please help or please point me to someone who might know.
Btw, this error only happens when i add external jar files (which i need for my project). Here are the list of external jar files that i have in my classpath.)
httpclient-4.0.1.jar from apache
httpcore -4.0.1.jarfrom apache
commons-codec-1.3.jar from apache
commons-logging-1.1.1.jar from apache
json_simple-1.1.jar from google
Here is the complete error:
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lorg/apache/commons/logging/impl/AvalonLogger;
[2010-05-02 21:57:05 - MyApp] at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
[2010-05-02 21:57:05 - MyApp] at com.android.dx.dex.file.DexFile.add(DexFile.java:143)
[2010-05-02 21:57:05 - MyApp] at com.android.dx.command.dexer.Main.processClass(Main.java:301)
[2010-05-02 21:57:05 - MyApp] at com.android.dx.command.dexer.Main.processFileBytes(Main.java:278)
[2010-05-02 21:57:05 - MyApp] at com.android.dx.command.dexer.Main.access$100(Main.java:56)
[2010-05-02 21:57:05 - MyApp] at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:229)
[2010-05-02 21:57:05 - MyApp] at com.android.dx.cf <http://com.android.dx.cf.direct.ClassPathOpener.pro> .direct.ClassPathOpener.processArchive(ClassPathOpener.java:244)
[2010-05-02 21:57:05 - MyApp] at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:130)
[2010-05-02 21:57:05 - MyApp] at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:108)
[2010-05-02 21:57:05 - MyApp] at com.android.dx.command.dexer.Main.processOne(Main.java:247)
[2010-05-02 21:57:05 - MyApp] at com.android.dx.command.dexer.Main.processAllFiles(Main.java:183)
[2010-05-02 21:57:05 - MyApp] at com.android.dx.command.dexer.Main.run(Main.java:139)
[2010-05-02 21:57:05 - MyApp] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[2010-05-02 21:57:05 - MyApp] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[2010-05-02 21:57:05 - MyApp] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[2010-05-02 21:57:05 - MyApp] at java.lang.reflect.Method.invoke(Method.java:592)
[2010-05-02 21:57:05 - MyApp] at com.android.ide.eclipse.adt.internal.sdk.DexWrapper.run(Unknown Source)
[2010-05-02 21:57:05 - MyApp] at com.android.ide.eclipse.adt.internal.build.ApkBuilder.executeDx(Unknown Source)
[2010-05-02 21:57:05 - MyApp] at com.android.ide.eclipse.adt.internal.build.ApkBuilder.build(Unknown Source)
[2010-05-02 21:57:05 - MyApp] at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:627)
[2010-05-02 21:57:05 - MyApp] at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
[2010-05-02 21:57:05 - MyApp] at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:170)
[2010-05-02 21:57:05 - MyApp] at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:201)
[2010-05-02 21:57:05 - MyApp] at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:253)
[2010-05-02 21:57:05 - MyApp] at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
[2010-05-02 21:57:05 - MyApp] at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:256)
[2010-05-02 21:57:05 - MyApp] at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:309)
[2010-05-02 21:57:05 - MyApp] at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:341)
[2010-05-02 21:57:05 - MyApp] at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:140)
[2010-05-02 21:57:05 - MyApp] at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:238)
[2010-05-02 21:57:05 - MyApp] at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
[2010-05-02 21:57:05 - MyApp] 4 errors; aborting
[2010-05-02 21:57:05 - MyApp] Conversion to Dalvik format failed with error 1
In r14 they changed the way in which external libraries are referenced and it can cause this problem. You can fix it by removing the linked folders (with _src in the name) from the folder tree:
Right click and select "Build Path > Remove from build path"
A popup will open. Make sure that “Also unlink the folder from the project” is checked and then accept it.
see http://android-developers.blogspot.co.uk/2011/10/changes-to-library-projects-in-android.html
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException:
already added:
Lorg/apache/commons/logging/impl/AvalonLogger;
You are attempting to add org.apache.commons.logging.impl.AvalonLogger twice to your project. Do not do that.
Also, much of what you are adding via JARs is already in Android, such as HttpClient. This may be contributing to your error.
I just had this as well but I made sure ahead of time that I did not have a duplicate class in my jar file. This was some other issue dealing with multiple loading of the same jar or something. The classpath and the list of Referenced Libraries looked appropriate. After some flailing around, some combination of the following fixed it:
I was using a different external jar that was also local in the directory. I removed it from the build-path and re-added it from the local jar instead.
I removed all external jars and re-added them one at a time making sure they were the right ones.
I removed the .classpath file in my project as well as the bin and gen directories.
I cleaned the project in Eclipse, forcing the files to be regenerated.
I also shuffled around the jar file above the gen directory in the build order.
Some combination of the above seemed to fix the issue. If it happens again, I will be more careful to see if I can reproduce it.
I had written a blog post about one possible cause of this error and its solution here. Hope this helps.
i guess that you put your jar in folder for example library and then, build path from this folder. You just remove this jar file and try select property from project, then Java build path -> Add external jars files. It will works fine.
I had this problem because I put the .jar under my src/ directory, so Eclipse copied it to the bin/ directory and tried to link it from both places. Moving it from src/ to libs/ fixed the problem.
My problem was due to having the same project references also in library projects. A few updates ago this was normal behaviour, but since the change in library handling, I now needed to remove the references from my projects and have only one of the libraries reference it.
This always happened to me after I did a custom build using a custom command using proguard.
I solved this problem by emptying the bin directory of my eclipse project directory and then cleaning the project (Eclipse menu "project" --> "clean...")
Obviously proguard makes a mess in this directory by which Eclipse gets confused...
I get really mad with this problem trying to do all the posible solutions, but none worked for me: Clean project, Re-build, erasing libraries, linking again the libraries, updating proguard, editing proguard files...
Finally the solution was much more easy: Project, Android Tools, Fix project propieties.
Now I can export the apk.
Right click the src and gen folders and select Build Path > Remove from Build Path.
then
Right Click > Build Path > Use as Source Folder
i got that from time to time when i tried to run code in an incompatible version of android (ie 2.2 when 4.0 was needed for a particular library to work)