Search code examples
cordovamulti-device-hybrid-apps

How to update Platform in (MDHA) MultiDeviceHybridApp


I am trying to use Camera plugin in a Crodva app developing by (MultiDeviceHybridApp) and I get this error:

Plugin doesn't support this project's cordova-android version. cordova-android: 4.1.1, failed version requirement: >=5.0.0-dev

Skipping 'cordova-plugin-camera' for android

based on the answer of this post Plugin doesn't support this project's cordova-android version. cordova-android: 4.1.1, failed version requirement: >=5.0.0-dev it seems that I need to upgrade the Platform, but running the below command in project folder will show this error

cordova platform update [email protected]

Current working directory is not a Cordova-based project


Solution

  • I found the solution, and I am writing it in case some body else has the same problem

    Open this folder %AppData%\npm\node_modules\vs-mda\node_modules\cordova\node_modules\cordova-lib\src\platforms there are two files in there,

    open platformsConfig.json You can see different platforms there, find android and change

    "android": {
        "parser_file": "../cordova/metadata/android_parser",
        "handler_file": "../plugman/platforms/android",
        "url": "https://git-wip-us.apache.org/repos/asf?p=cordova-android.git",
        "version": "~4.1.0"
    },
    

    to

    "android": {
        "parser_file": "../cordova/metadata/android_parser",
        "handler_file": "../plugman/platforms/android",
        "url": "https://git-wip-us.apache.org/repos/asf?p=cordova-android.git",
        "version": "~5.0.0"
    },
    

    Clean your project and build it again. ;)