contfedorov opened a new issue #1357:
URL: https://github.com/apache/cordova-android/issues/1357


   # Bug Report
   
   Looks like `cordova-android` v10.1.1 is getting installed incorrectly.
   
   ## Problem
   
   ### Step 1 - `cordova-android` update
   
   I have `cordova` v10.0.0 installed.
   
   Here is part of my project's `package.json`:
   
   ```
   ...
   "devDependencies": {
       "cordova-android": "^10.1.1",
       "cordova-ios": "^6.2.0",
   ...
   ```
   
   I've removed `platforms`, `plugins` and `node_modules` folders for fully 
clean building, run `cordova prepare android && cordova run android` and get 
the following console output:
   ```
   ...
   Discovered platform "android". Adding it to the project
   Using cordova-fetch for cordova-android@^9.0.0
   Adding android project...
   Creating Cordova project for the Android platform:
        Path: platforms/android
        Package: <...>
        Name: <...>
        Activity: MainActivity
        Android target: android-29
   Subproject Path: CordovaLib
   Subproject Path: app
   Android project created with [email protected]
   ...
   ```
   
   Such console output looks confusing. Not sure what `cordova-android` version 
is REALLY used. On the one hand, `cordova platform list` gives:
   
   ```
   Installed platforms:
     android 9.1.0
   ...
   ```
   
   On the other hand, `package.json` in `node_modules/cordova-android` contains:
   ```
   ...
     "version": "10.1.1"
   ...
   ```
   
   I've also tried to manually re-add `cordova-android`:
   
   ```
   cordova platform remove android
   cordova platform add [email protected]
   ```
   
   In this case, `cordova platform list` gives expected result:
   
   ```
   Installed platforms:
     android 10.1.1
   ...
   ```
   
   But when I remove `platforms`, `plugins` and `node_modules` folders, v9.1.0 
is getting installed again.
   
   ### Step 2 - `cordova-plugin-camera` update
   
   Now I'm trying to update `cordova-plugin-camera` from v5 to recently 
released v6. Using the following commands:
   ```
   cordova plugin rm cordova-plugin-camera
   cordova plugin add cordova-plugin-camera
   ```
   
   Here is what project's `package.json` contains now:
   ```
   ...
   "devDependencies": {
       "cordova-android": "^10.1.1",
       "cordova-ios": "^6.2.0",
       "cordova-plugin-camera": "^6.0.0",
   ...
   ```
   
   Again, I remove `platforms`, `plugins` and `node_modules` folders and run 
`cordova prepare android && cordova run android`. Here is what I have in 
console:
   ```
   ...
   Discovered plugin "cordova-plugin-camera". Adding it to the project
   Installing "cordova-plugin-camera" for android
   Plugin doesn't support this project's cordova-android version. 
cordova-android: 9.1.0, failed version requirement: >=10.0.0
   Skipping 'cordova-plugin-camera' for android
   ...
   ```
   
   Checking `cordova-android` version decides that I have v9.1.0 installed.
   
   ### What is expected to happen?
   
   Install `cordova-android` platform version listed in `package.json`, **NOT** 
one pinned in `cordova-lib`
   
   ### What does actually happen?
   
   `cordova-android` platform version is getting from `cordova-lib`
   
   
   ### Environment, Platform, Device
   <!-- In what environment, on what platform or on which device are you 
experiencing the issue? -->
   
   Dev platform:
   macOS Big Sur, version 11.6
   
   
   ### Version information
   <!--
   What are relevant versions you are using?
   For example:
   Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins
   Other Frameworks: Ionic Framework and CLI version
   Operating System, Android Studio, Xcode etc.
   -->
   
   Cordova CLI: v10.0.0
   
   Cordova Platforms:
   - Cordova Android 10.1.1
   
   Cordova Plugins:
   - `cordova-plugin-camera` 6.0.0
   
   
   ## Checklist
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   - [x] I searched for existing GitHub issues
   - [x] I updated all Cordova tooling to most recent version
   - [x] I included all the necessary information above
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to