CocoonJS&安培;科尔多瓦插件:"找不到类"错误 [英] CocoonJS & Cordova plugins: "class not found" error

查看:193
本文介绍了CocoonJS&安培;科尔多瓦插件:"找不到类"错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我会很高兴,如果我们对如何科尔多瓦插件应包装为CocoonJS一个例子。

I would be glad if we had an example on how cordova plugins should be wrapped for CocoonJS.

我想在一个简单的例子使用的设备为导向的插件(指南针),但之后该应用初始化, navigator.compass.getCurrentHeading()收益一个 CompassError 与code:

I'm trying to use the device-orientation plugin (compass) in a simple example but after the app has initialized, the navigator.compass.getCurrentHeading() returns an CompassError with the code:

Class not found

类名称不能正确解析,所以大概什么是错的config.xml文件。

The class name cannot be resolved correctly, so probably something's wrong with the config.xml file.

结合许多来源后,雷看起来是这样的:

After combining many sources, mine looks like this:

../ WWW / config.xml中

<?xml version='1.0' encoding='utf-8'?>
<widget id="my.compass.html" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>HelloCordovaCompass</name>
    <description>
        A sample Apache Cordova application that displays the current compass heading after the deviceready event.
    </description>
    <author email="a@cordova.apache.org" href="http://cordova.io">
    </author>
    <content src="index.html" />
    <access origin="*" />
    <preference name="fullscreen" value="true" />
    <preference name="orientation" value="landscape" />
    <preference name="webviewbounce" value="true" />   
    <feature name="App">
       <param name="android-package" value="org.apache.cordova.App" />
    </feature>      
    <feature name="Compass">
       <param name="android-package" value="org.apache.cordova.deviceorientation.CompassListener" />
    </feature> 
</widget>

我也试过,包括罗盘插件:

I've also tried to include compass as plugin:

<plugin name="Compass" value="org.apache.cordova.device-orientation" />   

没什么区别。

PS:的应用程式适用于平原科尔多瓦精细

PS: The app works fine on plain Cordova.

[更新]

也许问题就在这里:

在这个例子中我将压缩&LT;项目名称&gt; /平台/安卓/资产/ WWW 文件夹中。

For this example I zipped the <project-name>/platforms/android/assets/www folder.

我不知道这是否足以让科尔多瓦插件的应用程序,如不包含插件的本土code( CompassListener.java )和似乎工作的唯一部件实际上是它的JavaScript界面​​( compass.js CompassError.js 等)。

I'm not sure if this is enough for a Cordova plugin app, as the native code of the plugin is not included (CompassListener.java) and the only part that seems to work is actually its JavaScript interface (compass.js, CompassError.js, etc)..

在另一方面,如果我尝试压缩整个&LT;项目名称&gt; 目录在<一个底部指出, href=\"http://support.ludei.com/hc/en-us/articles/201895066-Getting-Started-with-Cordova-and-CocoonJS\"相对=nofollow> 这个 教程中,CocoonJS启动崩溃..

On the other hand, If I try to zip the whole <project-name> directory as pointed out at the bottom of this tutorial, the CocoonJS Launcher crashes..

那么,至少可以有人证实,发射实际上可以编译科尔多瓦插件?

So, could at least someone confirm that the launcher can actually compile Cordova plugins?

推荐答案

如果你想使用插件,你必须压缩所有科尔多瓦项目文件夹。例如:

If you want to use plugins you have to zip all Cordova project folders. Example:

cd ~/projects/ && zip -r -X hellococoonfull.zip helloCocoonJS && cd -

参看使用科尔多瓦插件的<一个href=\"http://support.ludei.com/hc/en-us/articles/201895066-Getting-Started-with-Cordova-and-CocoonJS\"相对=nofollow>入门科尔多瓦和CocoonJS 指南。

[更新]

该CocoonJS启动器是不是准备好插件呢。对于使用插件,你必须使用德云编译系统。

The CocoonJS Launcher is not ready for plugins yet. For using plugins you have to use de cloud compilation system.

这篇关于CocoonJS&安培;科尔多瓦插件:&QUOT;找不到类&QUOT;错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆