Getting "Caused by: java.lang.VerifyError:"
Asked Answered
L

6

6

I created an android application which is used as library in another android application. I used some third party jars in the android app which acts as a library. When I link this library in my android application and run it, I am getting the verify error when it tries to access the class present in the library. May I know what is the issue blocking here for me ? Any help greatly appreciated..

I attached the log here and Parser1 is the class inside the library. I am getting the error in the line when i try to create the object for Parser1 class.

06-06 10:05:43.742: WARN/dalvikvm(224): VFY: unable to resolve static method 3084: Lorg/codehaus/jackson/JsonToken;.values ()[Lorg/codehaus/jackson/JsonToken;
06-06 10:05:43.742: DEBUG/dalvikvm(224): VFY: replacing opcode 0x71 at 0x0005
06-06 10:05:43.742: DEBUG/dalvikvm(224): Making a copy of Lcom/support/utils/Parser1;.$SWITCH_TABLE$org$codehaus$jackson$JsonToken code (522 bytes)
06-06 10:05:43.752: WARN/dalvikvm(224): VFY: unable to find class referenced in signature (Lorg/codehaus/jackson/JsonParser;)
06-06 10:05:43.752: INFO/dalvikvm(224): Could not find method org.codehaus.jackson.JsonParser.getCurrentToken, referenced from method com.support.utils.Parser1.addSectionContentData
06-06 10:05:43.761: WARN/dalvikvm(224): VFY: unable to resolve virtual method 3077: Lorg/codehaus/jackson/JsonParser;.getCurrentToken ()Lorg/codehaus/jackson/JsonToken;
06-06 10:05:43.761: DEBUG/dalvikvm(224): VFY: replacing opcode 0x74 at 0x0002
06-06 10:05:43.761: DEBUG/dalvikvm(224): Making a copy of Lcom/support/utils/Parser1;.addSectionContentData code (2421 bytes)
06-06 10:05:43.761: WARN/dalvikvm(224): VFY: unable to resolve exception class 685 (Lorg/codehaus/jackson/JsonParseException;)
06-06 10:05:43.771: WARN/dalvikvm(224): VFY: unable to resolve exception class 685 (Lorg/codehaus/jackson/JsonParseException;)
06-06 10:05:43.771: WARN/dalvikvm(224): VFY: unable to resolve exception class 685 (Lorg/codehaus/jackson/JsonParseException;)
06-06 10:05:43.771: WARN/dalvikvm(224): VFY: unable to find exception handler at addr 0x19b
06-06 10:05:43.771: WARN/dalvikvm(224): VFY:  rejected Lcom/support/utils/Parser1;.addSectionContentData (Lorg/codehaus/jackson/JsonParser;Ljava/util/List;Lcom/support/ModelClasses/SectionContent;Lcom/support/ModelClasses/FeatureInfo;ZZLjava/lang/String;)Ljava/util/List;
06-06 10:05:43.781: WARN/dalvikvm(224): VFY:  rejecting opcode 0x0d at 0x019b
06-06 10:05:43.781: WARN/dalvikvm(224): VFY:  rejected Lcom/support/utils/Parser1;.addSectionContentData (Lorg/codehaus/jackson/JsonParser;Ljava/util/List;Lcom/support/ModelClasses/SectionContent;Lcom/support/ModelClasses/FeatureInfo;ZZLjava/lang/String;)Ljava/util/List;
06-06 10:05:43.781: WARN/dalvikvm(224): Verifier rejected class Lcom/support/utils/Parser1;
06-06 10:05:43.793: WARN/dalvikvm(224): threadid=15: thread exiting with uncaught exception (group=0x4001b188)
06-06 10:05:43.793: ERROR/AndroidRuntime(224): Uncaught handler: thread AsyncTask #1 exiting due to uncaught exception
06-06 10:05:43.812: ERROR/AndroidRuntime(224): java.lang.RuntimeException: An error occured while executing doInBackground()
06-06 10:05:43.812: ERROR/AndroidRuntime(224):     at android.os.AsyncTask$3.done(AsyncTask.java:200)
06-06 10:05:43.812: ERROR/AndroidRuntime(224):     at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
06-06 10:05:43.812: ERROR/AndroidRuntime(224):     at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
06-06 10:05:43.812: ERROR/AndroidRuntime(224):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
06-06 10:05:43.812: ERROR/AndroidRuntime(224):     at java.util.concurrent.FutureTask.run(FutureTask.java:137)
06-06 10:05:43.812: ERROR/AndroidRuntime(224):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
06-06 10:05:43.812: ERROR/AndroidRuntime(224):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
06-06 10:05:43.812: ERROR/AndroidRuntime(224):     at java.lang.Thread.run(Thread.java:1096)
06-06 10:05:43.812: ERROR/AndroidRuntime(224): Caused by: java.lang.VerifyError: com.support.utils.Parser1
06-06 10:05:43.812: ERROR/AndroidRuntime(224):     at com.Sample.checkforversioning(Sample.java:652)
06-06 10:05:43.812: ERROR/AndroidRuntime(224):     at com.Sample$checkVersionThread.doInBackground(Sample.java:682)
06-06 10:05:43.812: ERROR/AndroidRuntime(224):     at com.Sample$checkVersionThread.doInBackground(Sample.java:1)
06-06 10:05:43.812: ERROR/AndroidRuntime(224):     at android.os.AsyncTask$2.call(AsyncTask.java:185)
06-06 10:05:43.812: ERROR/AndroidRuntime(224):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
06-06 10:05:43.812: ERROR/AndroidRuntime(224):     ... 4 more
06-06 10:05:43.832: INFO/Process(52): Sending signal. PID: 224 SIG: 3

Thanks, Senthil.M

Limey answered 6/6, 2011 at 4:49 Comment(4)
can you be more explicit on the error? And did you copy your jar inside the project first and then added it to the Build Path or you only referenced it inside the Build Path from outside the project?Chapfallen
I created a directory called lib inside my library project and then referred it in the library. And this library is linked with the original android app.Limey
okay then. Can you please copy the full error stack trace from LogCat to see where the error is coming from?Chapfallen
Hi, I edited my question section with attached logs.. Thanks for the reply..Limey
S
11

In Eclipse, go to the Project properties -> Java Build Path. Select the Order and Export Tab and check your third party jars.

Saccharate answered 20/5, 2012 at 22:28 Comment(1)
How would this apply to Android Studio? I believe I am having the same error.Simms
P
2

That can be caused by something in the jar accessing something in Java that's not in the Android SDK. Look in LogCat for the exception and it may tell you what it's missing. If you have the sources for the 3rd party jar, try including them directly into your project; that will help pin down the problem.

You also need to run your jar file through the "dx" tool that comes with the sdk.

Putrescible answered 6/6, 2011 at 4:52 Comment(6)
I don ve the source of the 3rd party jar.. Can you please explain how to run my jar through dx tool. I don ve much knowledge abt it.. I tried approach given in the link androidorigin.blogspot.com/2011/02/…. Even then getting same issue. Thanks for the reply..Limey
It could not find the class com.support.utils.Parser1. Is that something that is supposed to be in the jar file? If you're using Eclipse, make sure that you followed the instructions for including a 3rd party jar. Also, if you're using Eclipse, there's no need to run the dx tool; it is done automatically.Putrescible
Hi frnd, I followed the 1 to 3 steps given in the developer link. There is an alternate option given there like "Add Library". May I know are you mentioning that one. If I click that Add Library option, I am not able to add 3rd party jars..Limey
@Senthil: "I am not able to add 3rd party jars." - Why not? Is there an error message?Putrescible
@Ted Hopp: If I click Add Library, I am getting some list of options like Andriod Classpath Container, Connectivity Driver Definition etc.. But if i click Add jar and refer the jars which are in library project, this verify error is getting solved for me.. Is it a proper fix or any other better approach is there ?? Bcoz I ve to manually configure this and refer the jars which are in library project to my original project.. I got his approach thru this link #5790870Limey
@Limey - I think that's a fine solution.Putrescible
N
0

If you are using ant, then you should add all your external jars to the following dir "libs" and also add following line in a new file: ant.properties: jar.libs.dir=libs

Neptune answered 16/6, 2012 at 4:59 Comment(0)
A
0

If you are getting a VerifyError after building a release version of your app using ProGuard, it might be related to some optimization issue. Refer to the documentation, which essentially suggests disabling optimization using -dontoptimize.

Anselma answered 13/11, 2012 at 16:53 Comment(0)
E
0

Removing all the jar files from the /libs folder and then adding them again followed by cleaning the project and building it fixed for me.

Eam answered 6/6, 2013 at 9:32 Comment(0)
V
0

The same error occurred to me, as I tried to catch the exception SQLDataException on v.8 API device as the corresponding class is not included in the v.8 API (the error did not occur in v.14 devices, where that class is included). In fact, SQLDataException.class is not present only in the android.jar of v.8 API, while it is included in the v.14 API. So I replaced the exception SQLDataException with the exception SQLException (whose SQLDataException is a subclass) and my app now runs fine on both API's devices.

Venom answered 11/10, 2013 at 6:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.