Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conversion to Dalvik format failed with error 1 with a scary message in the Console view

I've seen a few questions with this topic, but when I search for the other part I have in my error, I don't find anything, so I decided to post a question with the full explanation.

No errors are recognized in my code. Nowhere. All libraries are added, external library projects are successfully linked. There is no indication that anything should go wrong with a launch.

Yet, when I launch the application - Run, compile and build (automatically) - I get a pop up message stating that my project contains error(s) and that I should please fix them before attempting to launch the application again.

So I fiddle around with some properties, my colleague discovers that "Android Private Libraries" has to be checked in Properties -> Java Build Path -> Order and Export (which I've checked an unchecked along with the other check boxes, before). But when I run the application - same pop up, and the following in the Console view: (scary message)

[2013-06-22 20:55:03 - TheApplication] Dx 
trouble processing "java/sql/Savepoint.class":

Ill-advised or mistaken usage of a core class (java.* or javax.*)
when not building a core library.

This is often due to inadvertently including a core library file
in your application's project, when using an IDE (such as
Eclipse). If you are sure you're not intentionally defining a
core class, then this is the most likely explanation of what's
going on.

However, you might actually be trying to define a class in a core
namespace, the source of which you may have taken, for example,
from a non-Android virtual machine project. This will most
assuredly not work. At a minimum, it jeopardizes the
compatibility of your app with future versions of the platform.
It is also often of questionable legality.

If you really intend to build a core library -- which is only
appropriate as part of creating a full virtual machine
distribution, as opposed to compiling an application -- then use
the "--core-library" option to suppress this error message.

If you go ahead and use "--core-library" but are in fact
building an application, then be forewarned that your application
will still fail to build or run, at some point. Please be
prepared for angry customers who find, for example, that your
application ceases to function once they upgrade their operating
system. You will be to blame for this problem.

If you are legitimately using some code that happens to be in a
core package, then the easiest safe alternative you have is to
repackage that code. That is, move the classes in question into
your own package namespace. This means that they will never be in
conflict with core system classes. JarJar is a tool that may help
you in this endeavor. If you find that you cannot do this, then
that is an indication that the path you are on will ultimately
lead to pain, suffering, grief, and lamentation.

[2013-06-22 20:55:03 - TheApplication] Dx 1 error; aborting
[2013-06-22 20:55:03 - TheApplication] Conversion to Dalvik format failed with error 1

Has anyone gotten this message before? Why am I getting it? Where should I go look for "hidden libraries" or "internal libraries" that I might not even be aware of?

I've checked with my boss and colleague - they all have the same libraries in the project (since we're working on it together we obviously have to have the same things). So where should I go looking to fix this problem?

like image 237
marienke Avatar asked Jun 22 '13 19:06

marienke


2 Answers

I solve that removing android.jar in "Order and Export" tab in the proyect and in the libraries.

like image 193
benoffi7 Avatar answered Nov 15 '22 16:11

benoffi7


Has anyone gotten this message before?

Yes. Not since 2009, though.

Why am I getting it?

Because in the source code of your project, or in a JAR, you have another copy of the java.sql.Savepoint interface, other than the one that comes from the Android runtime.

Where should I go look for "hidden libraries" or "internal libraries" that I might not even be aware of?

Your Eclipse classpath. You may wish to edit your question with a screenshot of your "Order & Export" screen from the build path dialog.

like image 39
CommonsWare Avatar answered Nov 15 '22 18:11

CommonsWare