Cordova Android ClassCastException

Posted in General by Cesar Mon Jun 27 2016 20:27:49 GMT+0000 (UTC)·3·Viewed 767 times

Hello, I make a project with cordova. In iOS work fine, but y have this error in android: com.ionicframework.beacont520721 E/AndroidRuntime: FATAL EXCEPTION: main Process: com.ionicframework.beacont520721, PID: 2863 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ionicframework.beacont520721/com.ionicframework.beacont520721.MainActivity}: java.lang.ClassCastException: cannot be cast to com.innoquant.moca.phonegap.MOCApp at at at$800( at$H.handleMessage( at android.os.Handler.dispatchMessage( at android.os.Looper.loop( at at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke( at$ at Caused by: java.lang.ClassCastException: cannot be cast to com.innoquant.moca.phonegap.MOCApp at com.innoquant.moca.phonegap.MOCAPlugin.initialize( at org.apache.cordova.CordovaPlugin.privateInitialize( at org.apache.cordova.PluginManager.getPlugin( at org.apache.cordova.PluginManager.startupPlugins( at org.apache.cordova.PluginManager.init( at org.apache.cordova.CordovaWebViewImpl.init( at org.apache.cordova.CordovaActivity.init( at org.apache.cordova.CordovaActivity.loadUrl( at com.ionicframework.beacont520721.MainActivity.onCreate( at at at at  at$800(  at$H.handleMessage(  at android.os.Handler.dispatchMessage(  at android.os.Looper.loop(  at  at java.lang.reflect.Method.invoke(Native Method)  at java.lang.reflect.Method.invoke(  at$  at  What is the problem? Thanks
Ivan Gonzalez
June 28, 2016
Dear Cesar, Thank you for your message. In Android, MOCA Plugin needs to be started in a class that inherits from Application, and this class should be declared in the AndroidManifest.xml (reference: For the Cordova plugin, this is configured when the plugin is installed, however it not always possible to configure automatically it as it heavily depends on the project configuration itself. ###How to solve it Please go to the AndroidManifest.xml file of the Android project and add the following field to the `application` tag: android:name="com.innoquant.moca.phonegap.MOCApp" Example: ![]( If there is an existing class here, you will need to manually edit it and add the logic of the `com.innoquant.moca.phonegap.MOCApp` class, as you can only have one single class declared here. Please let us know if you have any issue with this, or send us an email to
July 1, 2016
Yes, this solve all problems :)

Ivan Gonzalez marked this as solved
Markdown is allowed