Ionic 4 Image Picker 崩溃 android 应用
Ionic 4 Image Picker Crashing android app
我正在使用离子图像选择器 select 多张图片并上传到 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)
})
安装插件:
ionic cordova plugin add cordova-plugin-telerik-imagepicker --variable PHOTO_LIBRARY_USAGE_DESCRIPTION="App wants to access your gallery"
安装依赖:
npm install --save @ionic-native/image-picker
使用下面提到的函数获取图像。
getPictures() {
this.imagePicker.getPictures({
maximumImagesCount: 5,
outputType: 1
}).then(selectedImg => {
selectedImg.forEach(i => this.images.push("data:image/jpeg;base64," + i));
})
}
安装cordova插件 :
command:- cordova plugin add cordova-android-support-gradle-release
2.移除平台 :
命令:- Ionic cordova 平台 rm android
3.添加平台 :
命令:-离子科尔多瓦平台添加android@8.0.0
4.构建项目 :
命令:-离子科尔多瓦构建android
在 android 平台版本 8.0.0
上测试正常
可以使用
* `cordova plugin add cordova-android-support-gradle-release`
* `ioinc cordova platform rm android`
* `ionic cordova platform add android`
* `ionic cordova build android`
我正在使用离子图像选择器 select 多张图片并上传到 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)
})
安装插件:
ionic cordova plugin add cordova-plugin-telerik-imagepicker --variable PHOTO_LIBRARY_USAGE_DESCRIPTION="App wants to access your gallery"
安装依赖:
npm install --save @ionic-native/image-picker
使用下面提到的函数获取图像。
getPictures() {
this.imagePicker.getPictures({
maximumImagesCount: 5,
outputType: 1
}).then(selectedImg => {
selectedImg.forEach(i => this.images.push("data:image/jpeg;base64," + i));
})
}
安装cordova插件 :
command:- cordova plugin add cordova-android-support-gradle-release2.移除平台 :
命令:- Ionic cordova 平台 rm android3.添加平台 :
命令:-离子科尔多瓦平台添加android@8.0.04.构建项目 :
命令:-离子科尔多瓦构建android在 android 平台版本 8.0.0
上测试正常
可以使用
* `cordova plugin add cordova-android-support-gradle-release`
* `ioinc cordova platform rm android`
* `ionic cordova platform add android`
* `ionic cordova build android`