【发布时间】:2018-02-27 02:47:25
【问题描述】:
我在 ionic 3 项目中使用cordova-sqlite-ext。我的代码在没有--prod 标志的情况下运行良好。
但是当我运行 ionic cordova run android --prod --relase 时,它显示“无法读取 openDatabase 的属性”
这是我的代码
export class SqlLiteServiceProvider {
private options = {name: 'db.db', location: 'default',existingDatabase: 1,createFromLocation:1};
public win = (<any>window);
private db : any;
constructor() {
try{
if(this.win.cordova){
this.db = this.win.sqlitePlugin.openDatabase(this.options);
}else{
this.db = this.win.openDatabase(this.options.name, '1.0', 'database', 5 * 1024 * 1024);
}
}catch(ex){
alert(ex); // always alert error when run with --prod flag
}
}
}
【问题讨论】:
标签: angular sqlite cordova typescript ionic3