0
votes

Ionic native plugins on my app started acting weird lately (it was working fine earlier).Whenever I try to call any method related to plugins (mainly ionic-native-camera-plugin, ionic-native-geolocation-plugin) it catches error in promise which reads Error: Java exception was raised during method invocation.

I don't know what went wrong, it was working fine few weeks ago.

PS: I tried removing android platform, tried removing each plugins. None of them worked.

Ionic Info

Ionic:

   ionic (Ionic CLI)  : 4.6.0 
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.1.9

Cordova:

   cordova (Cordova CLI) : 8.1.2 ([email protected])
   Cordova Platforms     : android 7.1.4, browser 5.0.4
   Cordova Plugins       : not available

System:

   Android SDK Tools : 26.0.2 
   NodeJS            : v8.11.3 
   npm               : 5.6.0
   OS                : Windows 10

here is the entire error message from camera plugin

Error: Java exception was raised during method invocation
    at androidExec (cordova.js:963)
    at Object.cameraExport.getPicture (Camera.js:156)
    at s (vendor.js:1)
    at vendor.js:1
    at vendor.js:1
    at new t (polyfills.js:3)
    at vendor.js:1
    at S (vendor.js:1)
    at vendor.js:1
    at l.<anonymous> (vendor.js:1)

I think this issue is more related with cordova.

1
@HasiiT Did this issue resolved? Do you have iframe in your APP? - H_H
@hareshhanat Sorry, I couldn't resolve this issue (I had to find alternate methods to achieve my requirements). And I did have an iframe in that app. Also, there was extensive usage of native plugins. What do you think about this issue? - HasilT

1 Answers

0
votes

Here is the solution which helped me was removing the from HTML and adding it using the scripts (after cordova.js was loaded and deviceready was fired) with simple jQuery call:

$('body').append('<iframe id="framed" style="border: none;" src="..."></iframe>');

After doing this, I tested on some devices and I was not getting this error anymore.