0

I am using Android ADT build V22.3.0-887826 for developing Android Application.In my application I am using external .jar file called flanagan.jar.I have added this .jar file in Referenced Libraries.In Editor view there was no error.But while running it in emulator it gives this error :

java.lang.NoClassDefFoundError

I solved this by clicking the checkbox near the added library (flanagan.jar) in Properties->JavaBuildPath->Projects->Order and Export.But now I am getting this error :

Conversion to Dalvik format failed with error 1

I tried the below link to fix this..

"Conversion to Dalvik format failed with error 1" on external JAR

But I cant remove that error.I dont know why this problem occurs.Please help me to fix this..I am new to Android..I googled this error so many times..I cant find proper solution

Community
  • 1
  • 1
Kiruba Karan
  • 39
  • 1
  • 11

2 Answers2

0

You have added the jar file in a way that makes it visible is some areas and not in others. This inconsistency is what is causing your problem. To solve it, first remove it from your project - right-click on the project, go to Build Path -> Java Build Path, then go to the libraries tab. Here, click on the jar file, then click remove.

Before doing anything else, Clean the project, then build.

Now add back the jar file properly - copy it into the Libs folder inside your project (do this using the File system, not Eclipse.

Back in Eclipse, again go the Libraries tab under Java Build Path, click on Add JARs... and add your jar file. Finally, go to the Order and Export tab and click the box next to the jar file. This final step is only necessary if you want to "export" the jar file so that other projects which depend on this project will be able to see the jar file.

RichardP
  • 532
  • 5
  • 7
0

If the above solution doesn't help, an alternative cause of the "conversion to dalvik format failed with error 1" stems from the JAR file being compiled with a newer JDK version than what the Android Environment is configured.

i.e. Make sure you're not compiling the JAR file with JDK1.8 and using JDK 1.7 or lower as your compiler compliance level in your eclipse project configuration.