首页 > 解决方案 > Ionic 4 图像选择器崩溃 android 应用程序

问题描述

我正在使用离子图像选择器来选择多个图像并上传到 Firestore 存储。但是插件 cordova 图像选择器正在使我的 android 应用程序崩溃。我看到了一个教程并做了一个 poc。插件在 poc 中运行良好。但是当我在我的应用程序中实现它时它崩溃了。我坚持了一个多星期。请任何人帮助我解决工作。

alert('hello')
this.images = [];

var options = {
  maximumImagesCount: 3,
  outputType: 1
}
    this.imagePicker.getPictures(options).then(async (results) => {
    alert('Image URI: ');

    for (var i = 0; i < results.length; i++) {
      this.base64Image = 'data:image/jpg;base64,' + results[i];

    }
     (err) => {
    //   // Handle error
    }
  }).catch(err => {
    alert('hello'+err)
  })

标签: typescriptionic-frameworkionic4

解决方案


  1. 安装cordova插件
    命令:-cordova插件添加cordova-android-support-gradle-release

    2.删除平台
    命令:- Ionic cordova platform rm android

    3.添加平台
    命令:- ionic cordova platform add android@8.0.0

    4.构建项目
    命令:- ionic cordova build android

    在 android 平台版本 8.0.0 上测试正常


推荐阅读