Nativescript 在构建之前发现没有问题的插件时突然找不到插件?
Nativescript suddenly can't find a plugin when building which it found before with no issues?
我正忙于开发一个非常基本的条码扫描器应用程序。我正在使用 Angular/Nativescript 并且我正在使用 nativescript-barcodescanner 插件。条形码扫描器插件在几个小时前运行良好。我在 app.component.ts 中更改了一些内容,但没有针对该插件进行任何更改。现在,当我构建我的应用程序时,我可以在构建过程中看到它找到并使用了插件,但在部署到 genymotion 模拟器后,我收到以下错误。我有 removed/re-installed 插件和 android 平台,没有任何变化...知道我还能 try/look 做什么吗?从错误消息看来,它正在 app/tns_modules 寻找插件,但我在应用程序中没有 tns_modules 文件夹(不确定它是否 moves/builds 在另一个目录中...
我的错误:
java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException:
Error calling module function
Error calling module function
Error: com.tns.NativeScriptException: Failed to find module: "nativescript-BarcodeScanner", relative to: /app/tns_modules/
com.tns.Module.resolvePathHelper(Module.java:220)
com.tns.Module.resolvePath(Module.java:60)
com.tns.Runtime.runModule(Native Method)
com.tns.Runtime.runModule(Runtime.java:244)
com.tns.Runtime.run(Runtime.java:238)
com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:17)
android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
android.app.ActivityThread.handleBindApplication(ActivityThread.java:4328)
android.app.ActivityThread.access00(ActivityThread.java:135)
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
android.os.Handler.dispatchMessage(Handler.java:102)
android.os.Looper.loop(Looper.java:
我的app.module.ts:
import { NgModule } from "@angular/core";
import { NativeScriptFormsModule } from "nativescript-angular/forms";
import { NativeScriptModule } from "nativescript-angular/platform";
import { HttpModule } from '@angular/http';
import { BarcodeScanner } from "nativescript-BarcodeScanner";
import { AppComponent } from "./app.component";
import { RestService } from './services/rest.service';
@NgModule({
imports : [
NativeScriptModule,
NativeScriptFormsModule,
HttpModule
],
declarations : [
AppComponent
],
providers : [
RestService,
BarcodeScanner],
bootstrap : [AppComponent]
})
export class AppModule {}
我的app.component.ts:
import { Component, Input, OnInit } from "@angular/core";
import { BarcodeScanner } from "nativescript-BarcodeScanner";
import { ProductModel } from './models/product';
import { RestService } from './services/rest.service';
@Component({
selector: "my-app",
templateUrl : "./app.component.html"
})
export class AppComponent implements OnInit {
public barcode: number;
public textBarcode: number;
@Input() product: ProductModel;
public constructor(private restService: RestService, private barcodeScanner: BarcodeScanner) {
}
submitTextBarcode() {
this.restService.getProduct(this.textBarcode)
.subscribe(
(res) => {
this.product = new ProductModel(res.BaseURI, res.CustomError, res.ProviderName, res.RequestFormData, res.RequestURI, res.ResponseCode, res.AvgQty1, res.AvgQty2, res.AvgQty3, res.BarCode, res.Description, res.POSDescription, res.POSPrice, res.ProductCode, res.PurchCount, res.StockOnHand); },
(res) => {
console.log("failure" + res);
}
);
}
submitBarcode(barcode: number){
this.restService.getProduct(barcode)
.subscribe(
(res) => {
this.product = new ProductModel(res.BaseURI, res.CustomError, res.ProviderName, res.RequestFormData, res.RequestURI, res.ResponseCode, res.AvgQty1, res.AvgQty2, res.AvgQty3, res.BarCode, res.Description, res.POSDescription, res.POSPrice, res.ProductCode, res.PurchCount, res.StockOnHand);
//console.log("returned product description: " + this.product.Description);
//console.log(res);
},
(res) => {
console.log("failure" + res);
}
);
//console.log("product: " + product);
}
public scan() {
this.barcodeScanner.scan({
formats : "EAN_13",
cancelLabel : "Stop scanning",
message : "Go scan something Use the volume buttons to turn on the flash",
preferFrontCamera : false,
showFlipCameraButton : false
}).then((result) => {
this.barcode = +result.text;
this.submitBarcode(this.barcode);
}, (errorMessage) => {
console.log("Error no scan" + errorMessage);
});
}
public ngOnInit() {
}
}
对你的导入使用小写..它对我有用所以我猜 Angular-CLi 对 from "nativescript-BarcodeScanner";
中的 CamelCase 不满意
我正忙于开发一个非常基本的条码扫描器应用程序。我正在使用 Angular/Nativescript 并且我正在使用 nativescript-barcodescanner 插件。条形码扫描器插件在几个小时前运行良好。我在 app.component.ts 中更改了一些内容,但没有针对该插件进行任何更改。现在,当我构建我的应用程序时,我可以在构建过程中看到它找到并使用了插件,但在部署到 genymotion 模拟器后,我收到以下错误。我有 removed/re-installed 插件和 android 平台,没有任何变化...知道我还能 try/look 做什么吗?从错误消息看来,它正在 app/tns_modules 寻找插件,但我在应用程序中没有 tns_modules 文件夹(不确定它是否 moves/builds 在另一个目录中...
我的错误:
java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException:
Error calling module function
Error calling module function
Error: com.tns.NativeScriptException: Failed to find module: "nativescript-BarcodeScanner", relative to: /app/tns_modules/
com.tns.Module.resolvePathHelper(Module.java:220)
com.tns.Module.resolvePath(Module.java:60)
com.tns.Runtime.runModule(Native Method)
com.tns.Runtime.runModule(Runtime.java:244)
com.tns.Runtime.run(Runtime.java:238)
com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:17)
android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
android.app.ActivityThread.handleBindApplication(ActivityThread.java:4328)
android.app.ActivityThread.access00(ActivityThread.java:135)
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
android.os.Handler.dispatchMessage(Handler.java:102)
android.os.Looper.loop(Looper.java:
我的app.module.ts:
import { NgModule } from "@angular/core";
import { NativeScriptFormsModule } from "nativescript-angular/forms";
import { NativeScriptModule } from "nativescript-angular/platform";
import { HttpModule } from '@angular/http';
import { BarcodeScanner } from "nativescript-BarcodeScanner";
import { AppComponent } from "./app.component";
import { RestService } from './services/rest.service';
@NgModule({
imports : [
NativeScriptModule,
NativeScriptFormsModule,
HttpModule
],
declarations : [
AppComponent
],
providers : [
RestService,
BarcodeScanner],
bootstrap : [AppComponent]
})
export class AppModule {}
我的app.component.ts:
import { Component, Input, OnInit } from "@angular/core";
import { BarcodeScanner } from "nativescript-BarcodeScanner";
import { ProductModel } from './models/product';
import { RestService } from './services/rest.service';
@Component({
selector: "my-app",
templateUrl : "./app.component.html"
})
export class AppComponent implements OnInit {
public barcode: number;
public textBarcode: number;
@Input() product: ProductModel;
public constructor(private restService: RestService, private barcodeScanner: BarcodeScanner) {
}
submitTextBarcode() {
this.restService.getProduct(this.textBarcode)
.subscribe(
(res) => {
this.product = new ProductModel(res.BaseURI, res.CustomError, res.ProviderName, res.RequestFormData, res.RequestURI, res.ResponseCode, res.AvgQty1, res.AvgQty2, res.AvgQty3, res.BarCode, res.Description, res.POSDescription, res.POSPrice, res.ProductCode, res.PurchCount, res.StockOnHand); },
(res) => {
console.log("failure" + res);
}
);
}
submitBarcode(barcode: number){
this.restService.getProduct(barcode)
.subscribe(
(res) => {
this.product = new ProductModel(res.BaseURI, res.CustomError, res.ProviderName, res.RequestFormData, res.RequestURI, res.ResponseCode, res.AvgQty1, res.AvgQty2, res.AvgQty3, res.BarCode, res.Description, res.POSDescription, res.POSPrice, res.ProductCode, res.PurchCount, res.StockOnHand);
//console.log("returned product description: " + this.product.Description);
//console.log(res);
},
(res) => {
console.log("failure" + res);
}
);
//console.log("product: " + product);
}
public scan() {
this.barcodeScanner.scan({
formats : "EAN_13",
cancelLabel : "Stop scanning",
message : "Go scan something Use the volume buttons to turn on the flash",
preferFrontCamera : false,
showFlipCameraButton : false
}).then((result) => {
this.barcode = +result.text;
this.submitBarcode(this.barcode);
}, (errorMessage) => {
console.log("Error no scan" + errorMessage);
});
}
public ngOnInit() {
}
}
对你的导入使用小写..它对我有用所以我猜 Angular-CLi 对 from "nativescript-BarcodeScanner";