java.lang.ClassNotFoundException: com.synconset.ImagePicker

Viewed 282

please help me! I have a project in ionic, I install the Imagepicker plugin with capacitor(https://ionicframework.com/docs/native/image-picker). I built the project. I am doing the emulation on a mobile device from Android Studio, what I want is to be able to select the images from the device gallery, but when I click on the Select image button, the following error appears:

2020-04-08 23:10:11.126 14266-14405/io.ionic.starter V/Capacitor/Plugin: To native (Cordova plugin): callbackId: ImagePicker1627263557, service: ImagePicker, action: getPictures, actionArgs: [{"maximumImagesCount":1,"width":0,"height":0,"quality":50,"allow_video":false,"title":"Select an Album","message":null,"outputType":1,"disable_popover":false}]
2020-04-08 23:10:11.127 14266-14405/io.ionic.starter W/System.err: java.lang.ClassNotFoundException: com.synconset.ImagePicker
2020-04-08 23:10:11.127 14266-14405/io.ionic.starter W/System.err:     at java.lang.Class.classForName(Native Method)
2020-04-08 23:10:11.127 14266-14405/io.ionic.starter W/System.err:     at java.lang.Class.forName(Class.java:454)
2020-04-08 23:10:11.127 14266-14405/io.ionic.starter W/System.err:     at java.lang.Class.forName(Class.java:379)
2020-04-08 23:10:11.127 14266-14405/io.ionic.starter W/System.err:     at org.apache.cordova.PluginManager.instantiatePlugin(PluginManager.java:489)
2020-04-08 23:10:11.127 14266-14405/io.ionic.starter W/System.err:     at org.apache.cordova.PluginManager.getPlugin(PluginManager.java:169)
2020-04-08 23:10:11.127 14266-14405/io.ionic.starter W/System.err:     at org.apache.cordova.PluginManager.exec(PluginManager.java:122)
2020-04-08 23:10:11.127 14266-14405/io.ionic.starter W/System.err:     at com.getcapacitor.MessageHandler.callCordovaPluginMethod(MessageHandler.java:70)
2020-04-08 23:10:11.127 14266-14405/io.ionic.starter W/System.err:     at com.getcapacitor.MessageHandler.postMessage(MessageHandler.java:46)
2020-04-08 23:10:11.127 14266-14405/io.ionic.starter W/System.err:     at android.os.MessageQueue.nativePollOnce(Native Method)
2020-04-08 23:10:11.127 14266-14405/io.ionic.starter W/System.err:     at android.os.MessageQueue.next(MessageQueue.java:336)
2020-04-08 23:10:11.127 14266-14405/io.ionic.starter W/System.err:     at android.os.Looper.loop(Looper.java:174)
2020-04-08 23:10:11.127 14266-14405/io.ionic.starter W/System.err:     at android.os.HandlerThread.run(HandlerThread.java:67)
2020-04-08 23:10:11.127 14266-14405/io.ionic.starter W/System.err: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.synconset.ImagePicker" on path: DexPathList[[zip file "/data/app/io.ionic.starter-aXQ2v-R9ZXz3eZr4UBPlRQ==/base.apk"],nativeLibraryDirectories=[/data/app/io.ionic.starter-aXQ2v-R9ZXz3eZr4UBPlRQ==/lib/x86, /system/lib, /system/product/lib]]
2020-04-08 23:10:11.127 14266-14405/io.ionic.starter W/System.err:     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
2020-04-08 23:10:11.127 14266-14405/io.ionic.starter W/System.err:     at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
2020-04-08 23:10:11.128 14266-14405/io.ionic.starter W/System.err:     at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
2020-04-08 23:10:11.128 14266-14405/io.ionic.starter W/System.err:  ... 12 more
2020-04-08 23:10:11.128 14266-14405/io.ionic.starter I/System.out: Error adding plugin com.synconset.ImagePicker.
2020-04-08 23:10:11.128 14266-14405/io.ionic.starter E/Capacitor: Post message error:
    java.lang.NullPointerException: Attempt to invoke virtual method 'void org.apache.cordova.CordovaPlugin.privateInitialize(java.lang.String, org.apache.cordova.CordovaInterface, org.apache.cordova.CordovaWebView, org.apache.cordova.CordovaPreferences)' on a null object reference
        at org.apache.cordova.PluginManager.getPlugin(PluginManager.java:171)
        at org.apache.cordova.PluginManager.exec(PluginManager.java:122)
        at com.getcapacitor.MessageHandler.callCordovaPluginMethod(MessageHandler.java:70)
        at com.getcapacitor.MessageHandler.postMessage(MessageHandler.java:46)
        at android.os.MessageQueue.nativePollOnce(Native Method)
        at android.os.MessageQueue.next(MessageQueue.java:336)
        at android.os.Looper.loop(Looper.java:174)
        at android.os.HandlerThread.run(HandlerThread.java:67)
```






1 Answers

This seems to be a known issue of ImagePicker - see here.

Some workarounds seem to be:

removing the single line "com.synconset.imagepicker": "~2.1.8" from package.json. And "com.synconset.imagepicker": { "PHOTO_LIBRARY_USAGE_DESCRIPTION": "Add multiple photos" } shows warning while execute the commands like: cordova platform add android and cordova run android.

Related