The fix to https://issues.apache.org/jira/browse/CB-9976 has created another one (or made it visible), and the initial problem is thus left unsolved.
Actually, I think the newly visible issue is something I've been suspecting for a while now. I'll explain it along the way.
I was able to reproduce with a minimal scenario:
(Step #2 is to fix another issue with 5.3.3, it has nothing to do with the issue at hand)
- npm rm -g cordova && npm i -g firstname.lastname@example.org
- mkdir -p <node/npm>/lib/node_modules/cordova/node_modules/cordova-lib/node_modules && ln -s <node/npm>/lib/node_modules/cordova/node_modules/cordova-app-hello-world <node/npm>/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/cordova-app-hello-world
- cordova create hello
- cd hello/
- cordova platform add --save android
- cordova plugin add --save cordova-plugin-facebook4 --variable APP_ID="123456789" --variable APP_NAME="myApplication"
- cordova -d compile android -- --minSdkVersion=15 <- At this point everything is okay, and this minSdkVersion is to work around another issue
- npm rm -g cordova && npm i -g email@example.com
Before we go on, open up <node/npm>/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/platforms/android.js and add the following line at #174
- cordova prepare android -d
So, the thing is: the code responsible for installing or uninstalling frameworks for android (I haven't checked other platforms completely) tries to access the platform version in a way that does not match reality. This bug only appears if you have a plugin that includes framework dependencies, as is the case with jeduan's cordova-plugin-facebook4.
options.platformVersion is never a valid attribute of this object, in any test I've done, and the correct way to get it should be options.cordova.version.
The thing is, I've been suspecting that plugin uninstallations were never able to handle gradle dependencies added by a plugin, as far as I remember.
I have all my platforms on version control, and I remember quite a few times when I had to remove or update plugins like this, I had to clean leftovers from a few places by hand. None of the following sections were updated properly on a plugin uninstallation process (I might have forgotten some):
- platforms/android/build.gradle (dependencies block: SUB-PROJECT DEPENDENCIES)
- platforms/ios/*.pdxproj (at every FRAMEWORK_SEARCH_PATHS section)