How can I use external JARs in an Android project?

前端 未结 12 1665
甜味超标
甜味超标 2020-11-21 11:40

I have created an Android project and added an external JAR (hessian-4.0.1.jar) to my project. I then added the JAR to the build path and checked it off in Order and Export.

12条回答
  •  南旧
    南旧 (楼主)
    2020-11-21 11:41

    I'm currently using SDK 20.0.3 and none of the previous solutions worked for me.

    The reason that hessdroid works where hess failed is because the two jar files contain java that is compiled for different virtual machines. The byte code created by the Java compiler is not guaranteed to run on the Dalvik virtual machine. The byte code created by the Android compiler is not guaranteed to run on the Java virtual machine.

    In my case I had access to the source code and was able to create an Android jar file for it using the method that I described here: https://stackoverflow.com/a/13144382/545064

提交回复
热议问题