简体   繁体   English

如何在phonegap android应用程序中包含jar文件?

[英]How to include jar files in phonegap android application?

I am using a third party jar which has java class files and also .so files in my armeabi folder and i want to use the functions of the jar into my phonegap application which i am running on android platform. 我正在使用第三方jar,它在我的armeabi文件夹中具有java类文件以及.so文件,并且我想将jar的功能用于我在android平台上运行的phonegap应用程序中。 I tried with including the jar in plugin.xml with the following command : 我尝试使用以下命令在jar.plugin.xml中包含jar:

<source-file src="src/android/xxx.jar" target-dir="libs" framework="true" />
<source-file src="src/android/MyPlugin.java" target-dir="src/com/mypackage" />

this doesn't work. 这行不通。 can anybody help and what's the proper way of including .so files and jar file into the project and access it's function in javascript.. Thanks in advance!!! 任何人都可以提供帮助,将.so文件和jar文件包含到项目中并在javascript中访问其功能的正确方法是什么。

This works great for me: <source-file src="libs/mylib.jar" target-dir="libs" /> 这对我非常<source-file src="libs/mylib.jar" target-dir="libs" /><source-file src="libs/mylib.jar" target-dir="libs" />

"libs" is the default folder for storing .jar files so your lib will be linked. “ libs”是用于存储.jar文件的默认文件夹,因此您的lib将被链接。

Take a look at an existing plugin using an external lib. 看一下使用外部库的现有插件。

An example ( https://github.com/Pushwoosh/pushwoosh-phonegap-3.0-plugin ) 一个例子( https://github.com/Pushwoosh/pushwoosh-phonegap-3.0-plugin

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM