javascript - Windows Phone 8.1 Plugin: class not found -


i have following problem following code:

plugin.xml

<?xml version="1.0" encoding="utf-8" ?> <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"         xmlns:android="http://schemas.android.com/apk/res/android"         id="barcodescanner-plugin"         version="0.0.1">     <name>barcode scanner plugin</name>     <description>cordova barcode scanner plugin...</description>     <author>xxx</author>     <license>bsd</license>      <config-file target="config.xml" parent="/*">          <feature name="barcodescanner">               <param name="wp-package" value="barcodescanner"/>          </feature>     </config-file>      <js-module src="www/barcodescanner.js" name="barcodescanner">          <clobbers target="window.barcodescanner" />     </js-module>      <plattform name="wp8">          <config-file target="properties/wmappmanifest.xml" parent="/deployment/app/capabilities">              <capability name="pointofsale"/>          </config-file>           <source-file src="src/wp/barcodescanner.cs" />           <framework src="lib/windows.devices.pointofservice.winmd" />          <framework src="lib/wpcordovaclasslib.dll" />     </plattform> </plugin> 

barcodescanner.js

var exec = require('cordova/exec');  var barcodescanner = {     result: "no result available<br />",     enable: function () {         try {             var = this;             this.result += "test 1<br />";             exec(function () { that.result += "test 2.1"; }, function (error) { that.result += "test 2.2: " + error; }, "barcodescanner", "enable", []);             this.result += "test 2<br />";         } catch (e) {             this.result += "exception occured<br />";             this.result += e.message + "<br />";         }     } }  module.exports = barcodescanner; 

barcodescanner.cs

using wpcordovaclasslib.cordova; using wpcordovaclasslib.cordova.commands; using wpcordovaclasslib.cordova.json;  namespace wpcordovaclasslib.cordova.commands {     public class barcodescanner : basecommand     {         public void enable(string options)         {             pluginresult result = new pluginresult(pluginresult.status.ok, "test... test...");              dispatchcommandresult(result);         }     } } 

index.js

var = 0;  function updateoutputtext() {     document.getelementbyid("output").innerhtml = + ": " + window.barcodescanner.result;     i++; }  window.setinterval(updateoutputtext, 1000);  (function () {     "use strict";      document.addeventlistener('deviceready', ondeviceready.bind(this), false);      function ondeviceready() {         window.barcodescanner.result += "step 1<br />";          // handle cordova pause , resume events         document.addeventlistener('pause', onpause.bind(this), false);         document.addeventlistener('resume', onresume.bind(this), false);          window.barcodescanner.result += "step 2<br />";         window.barcodescanner.enable();     };      function onpause() {     };      function onresume() {     }; })(); 

and following environment:

cordova tools vs13 cordova-version: 5.0.0 , 4.1.2 (in vs13)

target panasonic fz-e1 windows phone 8.1 embedded handheld

the app prints following when call it:

n: no results available step 1 step 2 test 1 test 2 test 2.2: class not found

if move:

    <config-file target="config.xml" parent="/*">          <feature name="barcodescanner">               <param name="wp-package" value="barcodescanner"/>          </feature>     </config-file> 

to wp8 segment not print test 2.2

if change:

exec(function () { that.result += "test 2.1"; }, function (error) { that.result += "test 2.2: " + error; }, "barcodescanner", "enable", []); 

to:

exec(function () { that.result += "test 2.1"; }, function (error) { that.result += "test 2.2: " + error; }, "barcodescanner.barcodescanner", "enable", []); 

or

exec(function () { that.result += "test 2.1"; }, function (error) { that.result += "test 2.2: " + error; }, "xxxbarcodescanner", "enable", []); 

it not print test 2.2

so don't know howto invoke c#-method... think barcodescanner right name because xxxbarcodescanner god damn wrong , barcodescanner.barcodescanner seems show same result. may tell me wrong? because @ moment i'm clueless.

regards, steven peter

got shirt - sure....

visual studio has nasty habit of messing config.xml, plugins. have found version randomly updated.

open config.xml in text mode , make sure barcode plugin reference there. create blank project, if need , add plugin , check same. have had version info plugin, wasn't there or version wrong.

also make habit of double-checking version numbers android, win8, etc. not update.

i vs, sometime tests patience. luck!


Comments