Open AnandKumar2610 opened 6 years ago
I'm getting the same issue, have you figured out how to overcome the crashing of app when getpictures called from imagepicker.
Hi @shaik305 Now I have using camera plugin for image picker. I can't solve that issue just ignore that..
how about picking multiple images ?
Now i'm using single picture select option... Let me know if u fixed this issue
sure @AnandKumar2610
first remove image picker plugins that you installed including native plugin wrapper
and then
use
cordova plugin add https://github.com/shaik305/cordova-plugin-image-picker.git --save
instead of
ionic cordova plugin add cordova-plugin-telerik-imagepicker --variable PHOTO_LIBRARY_USAGE_DESCRIPTION="your usage message"
and then
npm install --save @ionic-native/image-picker
thats it - you can use by calling the function below
import { ImagePicker } from '@ionic-native/image-picker';
constructor(private imagePicker: ImagePicker) { }
...
this.imagePicker.getPictures(options).then((results) => { for (var i = 0; i < results.length; i++) { console.log('Image URI: ' + results[i]); } }, (err) => { });
enjoy coding @AnandKumar2610
@shaik305 thank you very much. I'll try this solution... one doubt: import { ImagePicker } from ''; //but from link is empty
@AnandKumar2610
import { ImagePicker } from '@ionic-native/image-picker'
;
with cordova-plugin-telerik-imagepicker the app crashes trying to pick multiply images, but with cordova-plugin-image-picker v1.1.3 getting errors:
Native: tried calling ImagePicker.hasReadPermission, but the ImagePicker plugin is not installed.
Install the ImagePicker plugin: 'ionic cordova plugin add cordova-plugin-telerik-imagepicker'
Seems like ionic-native needs telerik-plugin to run
@pe1o2pl try using my forked plugin https://github.com/shaik305/cordova-plugin-image-picker.git
@shaik305 Thanks! work fine !
Hi @shaik305 Thanks man! it's working prefect!!!!
Hi @AnandKumar2610 , do you use @ionic-native/image-picker
wrapper? If yes, how did you manage to uninstall telerik-imagepicker plugin and use the one from @shaik305 repo? I have installed the plugin from https://github.com/shaik305/cordova-plugin-image-picker.git but still get that error:
Native: tried calling ImagePicker.hasReadPermission, but the ImagePicker plugin is not installed.
Install the ImagePicker plugin: 'ionic cordova plugin add cordova-plugin-telerik-imagepicker'`
Hi @pe1o2pl
add plugin https://github.com/shaik305/cordova-plugin-image-picker.git
npm install --save @ionic-native/image-picker
This is work for me.. try this steps and let me know. Thank you.
@shaik305 Thank you for your repo, I just wonder how come an official ionic-native cordova plugin does not work off the shelf? What was the issue?
@shaik305 Your solution is not working for me. When i try to add the plugin, build fails.
A solution related to changing supported android platforms resolved the issue for me.
2. ionic cordova plugin add cordova-android-support-gradle-release
2. ionic cordova platform rm android
3. ionic cordova platform add android
4. ionic cordova build android
@thevirajshelke Thanks, this solution works fine for me ionic v1 - cordova 9 - cordova-android 8.1
Thanks @thevirajshelke!
Whenever i call this code app will be crashed see below
this.imagePicker.getPictures({}).then((results) => { for (let i = 0; i < results.length; i++) { // stmt block } }, (err) => { // error block });
Error is
06:53:37 E AndroidRuntime : FATAL EXCEPTION: main 06:53:37 E AndroidRuntime : Process: io.ionic.starter, PID: 7436 06:53:37 E AndroidRuntime : java.lang.NoSuchMethodError: No static method getScreenWidthDp(Landroid/content/res/Resources;)I in class Landroid/support/v4/content/res/ConfigurationHelper; or its super classes (declaration of 'android.support.v4.content.res.ConfigurationHelper' appears in /data/app/io.ionic.starter-1/base.apk) 06:53:37 E AndroidRuntime : at android.support.v7.view.ActionBarPolicy.getMaxActionButtons(ActionBarPolicy.java:57) 06:53:37 E AndroidRuntime : at android.support.v7.widget.ActionMenuPresenter.initForMenu(ActionMenuPresenter.java:108) 06:53:37 E AndroidRuntime : at android.support.v7.view.menu.MenuBuilder.addMenuPresenter(MenuBuilder.java:264) 06:53:37 E AndroidRuntime : at android.support.v7.widget.Toolbar.setMenu(Toolbar.java:569) 06:53:37 E AndroidRuntime : at android.support.v7.widget.ToolbarWidgetWrapper.setMenu(ToolbarWidgetWrapper.java:369) 06:53:37 E AndroidRuntime : at android.support.v7.widget.ActionBarOverlayLayout.setMenu(ActionBarOverlayLayout.java:714) 06:53:37 E AndroidRuntime : at android.support.v7.app.AppCompatDelegateImplV9.preparePanel(AppCompatDelegateImplV9.java:1362) 06:53:37 E AndroidRuntime : at android.support.v7.app.AppCompatDelegateImplV9.doInvalidatePanelMenu(AppCompatDelegateImplV9.java:1648) 06:53:37 E AndroidRuntime : at android.support.v7.app.AppCompatDelegateImplV9$1.run(AppCompatDelegateImplV9.java:140) 06:53:37 E AndroidRuntime : at android.os.Handler.handleCallback(Handler.java:739) 06:53:37 E AndroidRuntime : at android.os.Handler.dispatchMessage(Handler.java:95) 06:53:37 E AndroidRuntime : at android.os.Looper.loop(Looper.java:135) 06:53:37 E AndroidRuntime : at android.app.ActivityThread.main(ActivityThread.java:5343) 06:53:37 E AndroidRuntime : at java.lang.reflect.Method.invoke(Native Method) 06:53:37 E AndroidRuntime : at java.lang.reflect.Method.invoke(Method.java:372) 06:53:37 E AndroidRuntime : at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905) 06:53:37 E AndroidRuntime : at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)
Anyone help! How can i fix? Thanks in advance...