Java – error upgrading Cordova application
For security reasons, I'm trying to get from Cordova 3.5 0 update a phone app to Cordova 5.1 one
W/System.err( 1672): org.json.JSONException: Value PluginManager at 0 of type java.lang.String cannot be converted to int W/System.err( 1672): at org.json.JSON.typeMismatch(JSON.java:100) W/System.err( 1672): at org.json.JSONArray.getInt(JSONArray.java:357) W/System.err( 1672): at org.apache.cordova.CordovaBridge.promptOnJsPrompt(CordovaBridge.java:131) W/System.err( 1672): at org.apache.cordova.engine.SystemWebChromeClient.onJsPrompt(SystemWebChromeClient.java:119) W/System.err( 1672): at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:655) W/System.err( 1672): at android.os.Handler.dispatchMessage(Handler.java:99) W/System.err( 1672): at android.os.Looper.loop(Looper.java:137) W/System.err( 1672): at android.app.ActivityThread.main(ActivityThread.java:4745) W/System.err( 1672): at java.lang.reflect.Method.invokeNative(Native Method) W/System.err( 1672): at java.lang.reflect.Method.invoke(Method.java:511) W/System.err( 1672): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) W/System.err( 1672): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) W/System.err( 1672): at dalvik.system.NativeStart.main(Native Method) W/System.err( 1672): org.json.JSONException: Value App at 0 of type java.lang.String cannot be converted to int W/System.err( 1672): at org.json.JSON.typeMismatch(JSON.java:100) W/System.err( 1672): at org.json.JSONArray.getInt(JSONArray.java:357) W/System.err( 1672): at org.apache.cordova.CordovaBridge.promptOnJsPrompt(CordovaBridge.java:131) W/System.err( 1672): at org.apache.cordova.engine.SystemWebChromeClient.onJsPrompt(SystemWebChromeClient.java:119) W/System.err( 1672): at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:655) W/System.err( 1672): at android.os.Handler.dispatchMessage(Handler.java:99) W/System.err( 1672): at android.os.Looper.loop(Looper.java:137) W/System.err( 1672): at android.app.ActivityThread.main(ActivityThread.java:4745) W/System.err( 1672): at java.lang.reflect.Method.invokeNative(Native Method) W/System.err( 1672): at java.lang.reflect.Method.invoke(Method.java:511) W/System.err( 1672): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) W/System.err( 1672): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) W/System.err( 1672): at dalvik.system.NativeStart.main(Native Method) W/System.err( 1672): org.json.JSONException: Value File at 0 of type java.lang.String cannot be converted to int W/System.err( 1672): at org.json.JSON.typeMismatch(JSON.java:100) W/System.err( 1672): at org.json.JSONArray.getInt(JSONArray.java:357) W/System.err( 1672): at org.apache.cordova.CordovaBridge.promptOnJsPrompt(CordovaBridge.java:131) W/System.err( 1672): at org.apache.cordova.engine.SystemWebChromeClient.onJsPrompt(SystemWebChromeClient.java:119) W/System.err( 1672): at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:655) W/System.err( 1672): at android.os.Handler.dispatchMessage(Handler.java:99) W/System.err( 1672): at android.os.Looper.loop(Looper.java:137) W/System.err( 1672): at android.app.ActivityThread.main(ActivityThread.java:4745) W/System.err( 1672): at java.lang.reflect.Method.invokeNative(Native Method) W/System.err( 1672): at java.lang.reflect.Method.invoke(Method.java:511) W/System.err( 1672): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) W/System.err( 1672): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) W/System.err( 1672): at dalvik.system.NativeStart.main(Native Method)
Solution
Editor: I didn't pass all the comments on other answers. I now realize that this answer may not be really useful OP, but anyway, it may help someone with Cordoba 3 X - > 5 migration battle
When you update Cordova, you often have to update the platform and plug-ins
Therefore, after upgrading the CLI as you did, you must remove all platforms and plug-ins and reinstall them
(if you only have what you want to save on the platform)
Before we start, save a list of plug-ins you use
cordova plugin list
Then we clean everything (Windows command prompt):
rd /s/q platforms rd /s /q plugins
Or for Linux / OS X:
rm -rf platforms rm -rf plugins
Please note that it is a "rough" way to delete platforms and plug-ins. You can just run Cordova platform to delete Android, and then you will have to deal with the file platforms JSON, you can use the Cordova plugin to delete... For each plugin, but it will be longer
Then you use Cordova plug - in add... To add all the plug - ins again
Be careful, the core plug-ins of Cordova 5 now use NPM instead of GIT, so you must check the new ID of each plug-in or you may get the old version
For example, use
cordova plugin add cordova-plugin-camera
replace
cordova plugin add org.apache.cordova.camera
Finally, you must add a new plug-in responsible for security
cordova plugin add cordova-plugin-whitelist
And in config XML and add a CSP meta tag to your HTML
And re add the platform:
cordova plugin add android