我正在尝试制作一个简单的 cordova android 插件,它需要在 jar 文件中定义的类。我有一个测试项目here https://github.com/konsumer/testpebble,其中包括示例用法和我的插件的简化版本。
在我的plugin.xml 中,我有这个:
<platform name="android">
<config-file target="res/xml/config.xml" parent="/*">
<feature name="Pebble">
<param name="android-package" value="com.jetboystudio.pebble.PebblePGPlugin"/>
</feature>
</config-file>
<source-file src="src/android/PebblePGPlugin.java" target-dir="src/com/jetboystudio/pebble" />
<source-file src="src/android/libs/pebble_kit.jar" target-dir="libs" />
</platform>
在我的测试项目中,我在需要的地方放置了pebblekit jar(我认为):plugins/com.jetboystudio.pebble.PebblePGPlugin/src/android/libs/pebble_kit.jar
当我“cordova build”时,我没有收到任何错误,但是当我安装 apk 文件时,我在 Chrome 设备检查中收到“找不到类”。我假设它找不到的类是 pebble_kit.jar 中定义的类之一。另外,它似乎没有将此文件复制到platforms/android 中。
如果我可以更好地调试(找不到哪个类?),如果没有人知道为什么这不起作用的实际答案,那可能是一个好的开始。
Your plugin.xml
是正确的。
请勿编辑plugin.xml
将插件添加/安装到项目中后。
当您运行cordova build或prepare时,它不会处理plugin.xml的本机部分,它只会在cordova插件添加上获取进程
更新您的插件存储库/文件夹plugin.xml
含有jar文件和您拥有的行是正确的。
Then do
cordova plugin rm
cordova plugin add
cordova build
最终结果验证/platforms/android/libs/pebble_kit.jar
在 cordova 构建之后出现。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)