开发者

java.lang.VerifyError on imported jar

开发者 https://www.devze.com 2023-02-19 13:59 出处:网络
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.VerifyE

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 library is Jiwigo 0.13.1.1; a java library for accessing Piwigo image galleries. I know this should work, because there's an open source android project called RegalAndroid that uses it too (though, an older version, and it copied the source instead of properly importing it). The .jar is the only copy of the library on my computer, so I'd be surprised if it was a version clash error. Any ideas?

Here's my error log (shortened because all the rest is normal android stuff):

FATAL EXCEPTION: main
java.lang.VerifyError: fr.mael.jiwigo.transverse.session.SessionManager
at com.terrapages.itemdetailsactivities.FavoritesDetailsActivity.initViews(FavoritesDetailsActivity.java:179)
at com.terrapages.itemdetailsactivities.FavoritesDetailsActivity.onResume(FavoritesDetailsActivity.java:83)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1149)
at android.app.Activity.performResume(Ac开发者_高级运维tivity.java:3823)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3118)
[...]

And the line it crashes on (with dummy string values that are different in the code):

SessionManager sessionManager = new SessionManager("username", "password", "gallery-url");

This is the first use of the library anywhere in the code.


I'm the developer of Jiwigo and read this post this afternoon by chance. As I do not develop on Android, I didn't even know that my api was not compatible with android.

So after I read this post, I made some changes on my API : I replaced the old Apache HttpClient version with a newest one : 4.1 (I think it's compatible with android isn't it ?) And I removed all JDom references. The code now uses org.w3c.dom.Document instead. The jar is here : http://maven.le-guevel.com/artifactory/libs-release-local/fr/mael/jiwigo/jiwigo-ws-api/0.2b/

As I said, I just made the modifications this afternoon, and I did not test it very well, so it could be unstable (it seems to work on my project).

Bye.


Any ideas?

SessionManager is using a class or method that does not exist in Android. Assuming this is the source for the class in question, there is no way that will work on Android without substantial modifications, as it uses:

  • an old version of Apache HttpClient
  • JDOM

neither of which are in Android.


I had a similar issue with my projects after doing the Android ADT , and Java updates.

Try these steps

  1. Remove links to your external libraries in your Android project.

  2. Move all your external libraries (including Google Ad libraries) to \libs folder inside your Android project.

  3. Re-link your libraries, that now exist in the Project\libs directory.

Hopefully this will help

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号