[ 
https://issues.apache.org/jira/browse/CB-10108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15036422#comment-15036422
 ] 

Frederico Costa Galvão commented on CB-10108:
---------------------------------------------

Thanks for the quick fix, Vladimir.
I've done some further research for my project, and I realized a few things:

* I edited cordova-lib/src/plugman/platforms/android.js with hardcoded 
*options.platformVersion = '4.1.1';* to upgrade my project, and it worked (all 
plugins were re-installed), and I realized that of the cases I said data was 
left behind, only one still remains:

# [FIXED] platforms/android/build.gradle (dependencies block: SUB-PROJECT 
DEPENDENCIES)
# [FIXED] platforms/android/project.properties
# [NOT FIXED] platforms/ios/*.pdxproj (at every FRAMEWORK_SEARCH_PATHS section)

So, although the pull request seems like will fix the reinstallation of plugins 
(as I've tested with the hardcoded version), there's still that leftover 
framework info on pbxproj. It's leaves dupes (see snippet ahead) everytime the 
plugin is processed, and although it doesn't really cause any issues on 
compilation or runtime, it's still a bug.

{code}
FRAMEWORK_SEARCH_PATHS = (
        "$(inherited)",
        "\"Tippz/Plugins/cordova-plugin-facebook4\"",
        "\"Tippz/Plugins/cordova-plugin-facebook4\"",
        "\"Tippz/Plugins/cordova-plugin-facebook4\"",
        "\"Tippz/Plugins/cordova-plugin-facebook4\"",
        "\"Tippz/Plugins/cordova-plugin-facebook4\"",
);
{code}

> Plugin framework management fails
> ---------------------------------
>
>                 Key: CB-10108
>                 URL: https://issues.apache.org/jira/browse/CB-10108
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: CordovaLib
>    Affects Versions: 5.4.1
>         Environment: Linux Xubuntu 13.10 x86_64, \{node -v === v5.1.0\} \{npm 
> -v === 3.3.12\}
>            Reporter: Frederico Costa Galvão
>            Assignee: Vladimir Kotikov
>              Labels: android, cordova-6.0.0, framework, gradle, plugin, 
> prepare, xcode
>
> 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 cordova@5.3.3
> * 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 cordova@5.4.1
> 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
> {code:javascript}
> console.log('options', JSON.stringify(options, null, 4));
> {code}
> * cordova prepare android -d
> Result:
> {code}
> Executing "before_prepare"  hook for all plugins.
> Searching PlatformJson files for differences between project vs. platform 
> installed plugins
> Reinstalling missing plugin cordova-plugin-device to android platform
> Beginning processing of action stack for android project...
> Action stack processing complete.
> Beginning processing of action stack for android project...
> Action stack processing complete.
> Reinstalling missing plugin cordova-plugin-facebook4 to android platform
> Beginning processing of action stack for android project...
> Uninstalling Android library: com.facebook.android:facebook-android-sdk:4.+
> options {
>     "platforms": [
>         "android"
>     ],
>     "options": {
>         "verbose": true,
>         "argv": []
>     },
>     "verbose": true,
>     "silent": false,
>     "browserify": false,
>     "projectRoot": "<path>/temp/testes/5.4.1/hello-facebook-device",
>     "cordova": {
>         "platforms": [],
>         "plugins": [
>             "cordova-plugin-device",
>             "cordova-plugin-facebook4"
>         ],
>         "version": "5.4.1"
>     },
>     "paths": [
>         
> "<path>/temp/testes/5.4.1/hello-facebook-device/platforms/android/assets/www"
>     ],
>     "variables": {
>         "APP_ID": "123456789",
>         "APP_NAME": "myApplication",
>         "PACKAGE_NAME": "io.cordova.hellocordova"
>     },
>     "usePlatformWww": true
> }
> Error during processing of action! Attempting to revert...
> Error: TypeError: Uh oh!
> Invalid Version: undefined
>     at new SemVer 
> (<node/npm>/lib/node_modules/cordova/node_modules/semver/semver.js:281:11)
>     at compare 
> (<node/npm>/lib/node_modules/cordova/node_modules/semver/semver.js:571:10)
>     at Function.gte 
> (<node/npm>/lib/node_modules/cordova/node_modules/semver/semver.js:620:10)
>     at module.exports.framework.uninstall 
> (<node/npm>/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/platforms/android.js:176:28)
>     at 
> <node/npm>/lib/node_modules/cordova/node_modules/cordova-lib/src/platforms/PlatformApiPoly.js:670:31
>     at Object.ActionStack.process 
> (<node/npm>/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/cordova-common/src/ActionStack.js:56:25)
>     at PlatformApiPoly.removePlugin 
> (<node/npm>/lib/node_modules/cordova/node_modules/cordova-lib/src/platforms/PlatformApiPoly.js:314:20)
>     at 
> <node/npm>/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/prepare.js:165:24
>     at _fulfilled 
> (<node/npm>/lib/node_modules/cordova/node_modules/q/q.js:787:54)
>     at self.promiseDispatch.done 
> (<node/npm>/lib/node_modules/cordova/node_modules/q/q.js:816:30)
> {code}
> 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/android/project.properties
> # platforms/ios/*.pdxproj (at every FRAMEWORK_SEARCH_PATHS section)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to