每次我尝试运行我的Ionic应用程序时,都无法加载Cordova SQLite插件和Splash Screen插件等本机插件。
在这行代码中发生了这种情况:
public void mapColor()
{
int height = nRows; int width = nCols;
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
WritableRaster raster = image.getRaster();
for (int i = 0; i < nRows; i++) {
for (int j = 0; j < nCols; j++) {
double value = values[i][j];
int[] color = new int[3];
int colValue = getColorValue(value); //In this case Green to Red strength
int percentage = ((100*colValue)/255);
int R; int G; int B = 0;
//Formula: Red= 255*percentage /100 G= (255*(100-percentage))/100
R = (255*percentage)/100; G=(255*(100-percentage))/100;
R = Math.round(R); G= Math.round(G);
color[0]= R; color[1] = G; color[2] = B; //100% will be bright red and 50% yellow
raster.setPixel(j, i, color);
//System.out.println("Value " + value + " Red is " + R + " Green is " + G);
}
}
JFrame jf = new JFrame();
JLabel jl = new JLabel();
ImageIcon ii = new ImageIcon(image);
jl.setIcon(ii);
jf.add(jl);
jf.setSize(200, 200);
jf.setVisible(true);
}
我收到以下错误:
this.dbLocal.executeSql('CREATE TABLE IF NOT EXISTS contacts(id INTEGER
PRIMARY KEY AUTOINCREMENT, nickname TEXT, firstName TEXT, lastName TEXT,
description TEXT)', {}).then(console.log('Contacts loaded'));
我还注意到在控制台日志中,尽管它安装在Ionic项目中,它仍无法找到原生SQLITE插件。我尝试卸载并重新安装它,以及:
Error: Uncaught (in promise): plugin_not_installed
答案 0 :(得分:1)
看起来您正在浏览器上进行测试并且浏览器无法使用sql native插件,这就是为什么您会出现这种情况。
您需要在真实的手机上进行测试,在那里工作没有任何问题。
答案 1 :(得分:0)
我也有同样的问题。我通过更正SQL查询消除了该错误。 交叉检查您的查询。