Ionic + Capacitor - Cordova Plugins exception
See original GitHub issueDescription of the problem:
Affected platform
- [ x] Android
- iOS
- electron
- web
OS of the development machine
- [x ] Windows
- macOS
- linux
Other information:
Capacitor version: 1.0.0
node version: 10.15.3 npm version: 6.9.0
Steps to reproduce: When I run my app, I see the following exceptions (and the plugins don’t work: AdMobFree and InAppPurchase v1)
V/Capacitor/Plugin: To native (Cordova plugin): callbackId: InAppBillingV31732914844, service: InAppBillingV3, action: init, actionArgs: []
W/System.err: java.lang.ClassNotFoundException: com.alexdisler.inapppurchases.InAppBillingV3
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:453)
at java.lang.Class.forName(Class.java:378)
at org.apache.cordova.PluginManager.instantiatePlugin(PluginManager.java:489)
at org.apache.cordova.PluginManager.getPlugin(PluginManager.java:169)
at org.apache.cordova.PluginManager.exec(PluginManager.java:122)
at com.getcapacitor.MessageHandler.callCordovaPluginMethod(MessageHandler.java:73)
at com.getcapacitor.MessageHandler.postMessage(MessageHandler.java:46)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:326)
at android.os.Looper.loop(Looper.java:160)
at android.os.HandlerThread.run(HandlerThread.java:65)
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 12 more
Suppressed: java.io.IOException: No original dex files found for dex location
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:354)
at dalvik.system.DexFile.<init>(DexFile.java:101)
at dalvik.system.DexFile.<init>(DexFile.java:75)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:394)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:354)
at dalvik.system.DexPathList.<init>(DexPathList.java:164)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:74)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:65)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:73)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:88)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:74)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:40)
at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:727)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:810)
at android.app.LoadedApk.getResources(LoadedApk.java:1032)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2345)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5798)
at android.app.ActivityThread.access$1100(ActivityThread.java:200)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6718)
W/System.err: at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
I/System.out: Error adding plugin com.alexdisler.inapppurchases.InAppBillingV3.
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:73)
at com.getcapacitor.MessageHandler.postMessage(MessageHandler.java:46)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:326)
at android.os.Looper.loop(Looper.java:160)
at android.os.HandlerThread.run(HandlerThread.java:65)
V/Capacitor: callback: -1, pluginId: Console, methodName: log, methodData: {"level":"error","message":"ERROR {}"}
E/Capacitor/Plugin/Console: ERROR {}
E/Capacitor: Unable to inject Capacitor, Plugins won't work
Link to sample project:
Issue Analytics
- State:
- Created 4 years ago
- Comments:17 (5 by maintainers)
Top Results From Across the Web
angular - Execution Failed capacitor-cordova-android-plugins ...
I am using Cordova plugin to use fileOpener in the capacitor ionic project. Before this, everything was working fine as I install following ......
Read more >Ionic: exception with camera after capacitor migration
I migrate my ionic app from cordova to capacitor. When I test camera(with cordova plugin) I have this bug. So I test also...
Read more >Capacitor Android Plugin Guide
Building Capacitor plugins for Android involves writing Java or Kotlin to interface ... an error string and optionally an error code and Exception...
Read more >Camera API Plugin: Capacitor and Cordova for Ionic Apps
The Capacitor/Cordova Camera API plugin lets users take photos, capture video, and choose images from the system's image library directly from Ionic apps....
Read more >Problem with ionic-appauth on Android device (iOS works ok)
I have an Ionic app (Ionic 6, Capacitor 3, Angular 13) and for Okta ... Our app still makes use of the cordova-plugin-inappbrowser...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@tgangso @orhan-swe did you guys find a way to add a billing key manually? I am struggling to find a solution myself
Variables and hooks don’t work on Capacitor, you have to check the plugin and see what they do with the variable/hook and do it yourself manually.