找不到phonegap 3.1 BarcodeScanner未捕获的模块cordova/plugin/BarcodeScanner [英] phonegap 3.1 BarcodeScanner uncaught module cordova/plugin/BarcodeScanner not found
问题描述
我是Phonegap和JS的新手...并且我使用条形码扫描仪进行了尝试...通过本教程安装了phonegap以及所有内容
I'm new on Phonegap and JS... and I tried it with a barcode scanner... I installed the phonegap and everything with this tutorial http://teusink.blogspot.com/2013/07/guide-phonegap-3-android-windows.html
我从CMD安装了BarcodeScanner并将项目导出为android平台... 将其添加到Eclipse中……按照所有教程的操作方法进行操作,添加了所有权限和内容.
I installed the BarcodeScanner from CMD and exported the project as android platform... Add it to Eclipse ... followed all the tutorials how to do it, added all permissions and stuff..
当我在mamsung tab2上尝试该应用程序时...出现该应用程序,但是当我单击扫描"链接时,我得到了未在logcat中找到的错误未捕获模块cordova/plugin/BarcodeScanner.
when i try the app on ma samsung tab2 ... the app comes up but when i click the "scan" link i get the error uncaught module cordova/plugin/BarcodeScanner not found in the logcat.
这是呼叫<a href="#" class="btn large" onclick="scaning();">Scan</a
我在索引html头中有这个
i have this in the index html head
<script src="phonegap.js"></script>
<script src="barcodescanner.js"></script>
这是扫描功能 函数scaning(){
this is the scaning function function scaning(){
var scanner = cordova.require("cordova/plugin/BarcodeScanner");
scanner.scan(
function (result) {
alert("We got a barcode\n" +
"Result: " + result.text + "\n" +
"Format: " + result.format + "\n" +
"Cancelled: " + result.cancelled);
},
function (error) {
alert("Scanning failed: " + error);
}
);};
这是在config.xml中
and this is in the config.xml
<feature name="BarcodeScanner">
<param name="android-package" value="com.phonegap.plugins.barcodescanner.BarcodeScanner" />
</feature>
我认为我已经检查了整个Google的答案...但是到目前为止,仍然没有任何结果...而且对于phonegap 3.0+版本,几乎没有条形码扫描器的文档...至少对于初学者而言. ..
I think I checked the whole Google for the answer ... but till now nothing worked... and still for the phonegap 3.0+ version there is almost none documentation for the barcode scanner ... at least for a beginner ...
如果你能帮助我....因为我完全迷失了:S
if you can help me guys .... couse I'm totally lost :S
推荐答案
遇到了同样的问题,通过像这样的plugman进行安装即可解决此问题
Had the same problem , got fixed by installing it via plugman like this
plugman install --platform android --project = DIR-TO-CORDOVA-PROJECT --plugin = https://github.com/wildabeast/BarcodeScanner
plugman install --platform android --project=DIR-TO-CORDOVA-PROJECT --plugin=https://github.com/wildabeast/BarcodeScanner
其中DIR-TO-CORDOVA-PROJECT是E:/ProjectName/platform/android
where DIR-TO-CORDOVA-PROJECT is E:/ProjectName/platform/android
如果我没有添加/platform/android,则会报错
If I didn't add the /platform/android it gave an error
然后将其放入scan()函数
and then put this in the scanning() function
cordova.plugins.barcodeScanner.scan(
function (result) {
alert("We got a barcode\n" +
"Result: " + result.text + "\n" +
"Format: " + result.format + "\n" +
"Cancelled: " + result.cancelled);
},
function (error) {
alert("Scanning failed: " + error);
}
);
这篇关于找不到phonegap 3.1 BarcodeScanner未捕获的模块cordova/plugin/BarcodeScanner的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!