I tried to compile reddit-is-fun, a reddit reader for Android. If I start开发者_StackOverflow中文版 the application from ADT (either by debug or simply running) it will launch and run correctly on my phone (HTC Desire). However, if I export a signed and zipaligned package and install it, it will not work. The logcat shows NoSuchMethodError exceptions for Jackson. It is two jars, present in the repository and added to the build path. I made sure that the two have the same versions and even replaced them with newer ones.
I'm not really familiar with using jar libraries. Are they "linked" into the resulting apk like a static library is linked to an executable when compiling C++? How can I make sure that the app on the device will load the same version used for compiling? (which is most likely the problem).
Sounds like the Proguard obfuscation is breaking it. Try disabling Proguard to confirm (or add Jackson to the whitelist in proguard.cfg
)
I think it means that your JARs are not correctly translated from JVM format to Dalvik VM format. As you know Android uses different bytecode than ordinary desktop JVM. You should convert your JARs from JVM bytecode to Dalvik's bytecode. Try to Google "convert JVM to Dalvik"
精彩评论