Android java.lang.VerifyError?

作者: 蔡宝e | 来源:发表于2020-12-21 14:06 被阅读0次

转自Android java.lang.VerifyError? - Stack Overflow

问题:

In my Android app, I always get VerifyErrors! And I cannot figure out why. Whenever I include a external JAR, I always get VerifyErrors when I try to launch my app (except for once, when I included Apache Log4j.)

I usually get around this by taking the source of the library and adding it to my project, but I am trying to put the GData client library.

I can get this in source, but it's dependencies (mail.jar, activation.jar, servlet-api.jar) I cannot, so I get verify errors. I would like to get to the root of this problem once and for all. I looked on the internet, but they all seem to talk about incomplete class files? which I do not know of.

回答

Look at LogCat and see what's causing the verifyerror. It's probably some method in a java.lang class that is not supported on the android SDK level you are using (for instance, String.isEmpty()).

追加:

1,This should be marked as real answer. At least what it was exactly in my case since I was getting sporadic errors from my users and I tracked it down to View.getTag(int) call that is not supported in v. 3 of API –Bostone Aug 14 '10 at 6:33

2,Agreed. I have encountered this a few times and each time it's that I'm targeting 2.x and using something that's not in 1.5. What throws you off is it's thrown when the class is created/used for the first time only, so if it's something that happens sporadically you might not notice it for a while. –mbafford Dec 15 '10 at 1:39

3,If this is the case, you should checkout these links: developer.android.com/resources/articles/… and doandroids.com/blogs/2010/5/8/backwards-compatibility –MyName Dec 21 '10 at 22:52 

4,"This should be marked as real answer." I came accross this thread because I have the same problem. I'm guessing the reason why this was not marked as the real answer is because LogCat gives a line reference to where I am making an instance of a library but not the line where the problem is caused. In other words, in this case LogCat is near useless. –NotACleverMan Feb 7 '12 at 12:33

logcat at WARN level should show you the details on why it failed verify –mmeyer Mar 9 '12 at 8:57

相关文章

网友评论

    本文标题:Android java.lang.VerifyError?

    本文链接:https://www.haomeiwen.com/subject/nburnktx.html