Skip to content

Android Error – Error in Imported Libraries

Getting "Conversion to Dalvik format failed with error 1" in your Android project? Here's how to fix the error caused by imported libraries, step by step.

Ramón Invarato

When you get the following error in a project:

Conversion to Dalvik format failed with error 1

Solution

Right-click the project and choose "Properties".

Screenshot of the Eclipse project context menu with the Properties option highlighted

Go to the Android tab and, at the very bottom, remove all the libraries that are listed. Apply the changes and then add back the ones you need.

Screenshot of Properties on the Android tab with the library list, Remove and Apply buttons highlighted

Close the window and check that you no longer get any errors.

If you still get the same error, go back to the previous tab and remove the libraries again. Leave them removed this time.

Then, in the same window, go to “Java Build Path” and open the Libraries tab.

You need to remove all the library references except the one called “Android X.Y” (where X.Y is the version of the operating system; in the example it is 2.1).

Screenshot of Java Build Path, Libraries tab, with the library list and Remove button highlighted

Close the window and look at your class to check that no red crosses appear. If there are none, it will work now.

If there are red crosses, take note of where they are, since those will be libraries that haven’t been removed, and go back to the previous window.

Now go to the Source tab. There, delete everything except the folders ending in “/gen” and “/src”.

Screenshot of Java Build Path, Source tab, with the /gen and /src folders and Remove button highlighted

Close the window and find the ones you noticed earlier that had the red cross and now don’t. Delete them manually. Everything should work now.

“Android Error – Error in Imported Libraries” by Ramón Invarato at jarroba.com, licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0. Registered at Safe Creative.

Ramón Invarato

I design and build data platforms and intelligent systems, and I enjoy sharing that experience here.

You may also like

Android Error – Lost References

Getting errors across your whole Android project and "The type java.lang.String cannot be resolved"? Here's a quick fix using Organize Imports in Eclipse.

Dec 12, 2011

Comments

Leave a comment


This site uses Akismet to reduce spam. Learn how your comment data is processed.