1

I have imported a .jar into my Eclipse Android project (importing it to the libs folder and adding the jar to the libraries in Java Build Path), but when I attempt to use it, I get a java.lang.VerifyError. The JAR library I am using is starIOport.jar. It is from SDK for using mobile printers on android phones. It is made by Star Micronics company. My printer is SM-T300, but it probably doesnt matter since I dont even get to communicating with the printer. I get the error every time I get to the object, whose class imports classes from the jar. Does anyone know, what to do? I havend found anywhere on the internet anyone ancountering this specific problem with this jar. I dont think there is some incompatible stuff with android in it, since it is made for android devices. Does not work on my friends android phone either. Not even in emulator.

Link to the SDK. It is newer version, but I have the same problem with this version as well.: http://www.starmicronics.com/absolutefm/absolutefm/?f=174

Here is my log

05-05 14:26:46.032: E/AndroidRuntime(3006): Caused by: java.lang.VerifyError: com.StarMicronics.StarIOSDK.PrinterFunctions
05-05 14:26:46.032: E/AndroidRuntime(3006):     at com.StarMicronics.StarIOSDK.StarIOSDKActivity.GetStatus(StarIOSDKActivity.java:71)

and this is the line thats causing it. It is not the only one, every line doing something with the class PrinterFunctions, which imports jar classes, causes the error.

PrinterFunctions.CheckStatus(this, portName, portSettings);
marstaj
  • 51
  • 4
  • Have you read this? http://stackoverflow.com/a/2518002/683905 If there is source code of that jar avaiable, I'd try to add it directly into your project, that could help... – Jaa-c May 05 '12 at 13:16
  • Thx, I have read it, and a lot more, but it didnt help. I finally discovered, that the problem was not in the JAR itself, but in importing the JAR in project itself. Somehow eclipse ignored the JAR in buildpath and I had to import it [this way](http://stackoverflow.com/a/10106710/1299205). Interesting is, that in order to make their example project work, I had to delete the JAR and add it this way too. Strange problems sometimes.. – marstaj May 05 '12 at 13:57

1 Answers1

1

Library handling was changed since r17's release, assuming you're using this ADT version or higher.

You can do this too to remedy the issue:

  1. Project Properties > Java Build Path > Order and Export
  2. Bring the JAR to the top of the list

This is a great article to reference for JAR issues after upgrading from r16: http://android.foxykeep.com/dev/how-to-fix-the-classdefnotfounderror-with-adt-17

LtH
  • 692
  • 7
  • 18