2016-12-08 1 views
0

私は非常に基本的なバーコードスキャナアプリで忙しいです。 Angular/Nativescriptを使用していて、nativescript-barcodescannerプラグインを使用しています。バーコードスキャナープラグインは、数時間前まで正常に動作しました。 app.component.tsでいくつか変更しましたが、プラグイン固有のものは何も変更しませんでした。今私は私のアプリケーションをビルドすると、プラグインを見つけて使用するビルドプロセス中に見ることができますが、genymotionエミュレータにデプロイした後、次のエラーが発生します。私はプラグインとアンドロイドのプラットフォームを変更せずに削除/再インストールしました...他に何が試してみることができますか? ...それはそれはアプリ/ tns_modulesでプラグインを探しているエラーメッセージからと思われるが、それは/に移動し、別のディレクトリに構築するかどうかはわからないアプリでtns_modulesフォルダを(持っていない以前に見つけたものをビルドするときにNativescriptが突然プラグインを見つけられませんでしたか?

私のエラー:

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.access$1500(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() {  

    } 

} 
+0

プラットフォームのフォルダを掃除して再構築してみてください。あるいは単にプラットフォームを削除してから、新しいビルドを生成するために '実行 'します。 –

+0

@ブラッドマーティン私はこれをやったことがありますが、まだ運がありません... – user2094257

+0

それは問題がapp.module.tsにあるようです:唯一の違いは、私がBarcodescannerをインポートリストに追加したことですプロバイダー? – user2094257

答えて

2

会社あなたのインポートの小文字..それは私の側で動作するので、私は角のCLiはキャメルケースで満足していないと思いますfrom "nativescript-BarcodeScanner";

関連する問題