How to add third-party jar files into my android application jar file?

六月ゝ 毕业季﹏ 提交于 2019-11-29 12:35:08

Suppose your main extension jar file is extension.jar and you are using code in external.jar. Then you can put the classes from external.jar into extension.jar using the Java jar tool:

jar -xf external.jar

This will extract the .class files into package folders. If the top-level package is "com", then you can add those to extension.jar with:

jar -uf extension.jar com

(Repeat the second command for each top-level package in the external jar.)

If you are using Eclipse to develop, right click on the project and go to:

Properties -> Java Build Path -> Libraries -> Add External JARs

I was having issue with creating an Android ANE for AdMobs and this is what worked for me.

Do like Flynn suggested and add the jar in the Java Build Path:

Then, the only way I could get the AdMobs jar to play nice in the ANE was to export the Android native jar for the ANE with Export... -> Java -> JAR File and have both "Export all output folders for checked projects" and "Export Java source files and resources" checked:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!