Cordova插件开发和更新

时间:2016-09-19 04:58:33

标签: android cordova

我试图在Cordova开发插件,这似乎有效。当我尝试运行它时,我的应用程序崩溃了:

W/System.err(12878): java.lang.ClassNotFoundException: com.xiaoyi.action

W/System.err(12878):    at java.lang.Class.classForName(Native Method)

W/System.err(12878):    at java.lang.Class.forName(Class.java:251)

W/System.err(12878):    at java.lang.Class.forName(Class.java:216)

W/System.err(12878):    at org.apache.cordova.PluginManager.instantiatePlugin(PluginManager.java:490)

W/System.err(12878):    at org.apache.cordova.PluginManager.getPlugin(PluginManager.java:170)

W/System.err(12878):    at org.apache.cordova.PluginManager.startupPlugins(PluginManager.java:98)

W/System.err(12878):    at org.apache.cordova.PluginManager.init(PluginManager.java:87)

W/System.err(12878):    at org.apache.cordova.CordovaWebViewImpl.init(CordovaWebViewImpl.java:116)

W/System.err(12878):    at org.apache.cordova.CordovaActivity.init(CordovaActivity.java:144)

W/System.err(12878):    at org.apache.cordova.CordovaActivity.loadUrl(CordovaActivity.java:214)

W/System.err(12878):    at com.ionicframework.beekcontrolapp845287.MainActivity.onCreate(MainActivity.java:32)

W/System.err(12878):    at android.app.Activity.performCreate(Activity.java:5541)

W/System.err(12878):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)

W/System.err(12878):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2411)

W/System.err(12878):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2507)

W/System.err(12878):    at android.app.ActivityThread.access$900(ActivityThread.java:172)

W/System.err(12878):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308)

W/System.err(12878):    at android.os.Handler.dispatchMessage(Handler.java:102)

W/System.err(12878):    at android.os.Looper.loop(Looper.java:146)

W/System.err(12878):    at android.app.ActivityThread.main(ActivityThread.java:5692)

W/System.err(12878):    at java.lang.reflect.Method.invokeNative(Native Method)

W/System.err(12878):    at java.lang.reflect.Method.invoke(Method.java:515)

W/System.err(12878):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)

W/System.err(12878):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)

W/System.err(12878):    at dalvik.system.NativeStart.main(Native Method)

W/System.err(12878): Caused by: java.lang.NoClassDefFoundError: com/xiaoyi/action

W/System.err(12878):    ... 25 more

W/System.err(12878): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.xiaoyi.action" on path: DexPathList[[zip file 

我认为这是来自plugin.xml

<?xml version="1.0" encoding="UTF-8"?>

    Cordova Plugin Yi

<!-- android -->
<platform name="android">
  <js-module src="www/plugin.js" name="plugin">
    <runs/>

    <clobbers target="XiaomiYi" />
  </js-module>
  <config-file target="res/xml/config.xml" parent="/*">
    <feature name="CordovaXiaomiYi">
      <param name="android-package" value="com.xiaoyi.action" />
      <param name="onload" value="true" />
    </feature>
  </config-file>

  <source-file src="src/android/com/xiaoyi/XiaomiYiCordovaPlugin.java" target-dir="src/com/xiaoyi/action" />
</platform>

我的问题是,我该如何解决这个问题?我是否在插件目录中进行了更改并删除然后为每次尝试重新安装插件 - 或者我是否对Android平台文件夹或Cordova / Plugins目录进行了更改!?

1 个答案:

答案 0 :(得分:0)

感谢看起来,一旦插件在安装方面正常工作,我就可以直接在平台上编辑Java。我完成后,我会更新插件。