简体   繁体   中英

Ionic 3 Native Plugin Error: Java exception was raised during method invocation

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 (cordova-lib@8.1.1)
   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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM